Skip to content

Commit

Permalink
Merge pull request #559 from camptocamp/publish-poetry
Browse files Browse the repository at this point in the history
Be able to publish package that respect the PEP 517
  • Loading branch information
sbrunner authored May 5, 2022
2 parents e247147 + 40370e5 commit 48e35fd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
2 changes: 2 additions & 0 deletions c2cciutils/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,8 @@
"group": str,
# The path of the pypi package
"path": str,
# The command used to do the build
"build_command": List[str],
},
total=False,
)
Expand Down
24 changes: 17 additions & 7 deletions c2cciutils/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,23 @@ def pip(
env["VERSION"] = version

cwd = os.path.abspath(package.get("path", "."))
cmd = ["python3", "./setup.py", "egg_info", "--no-date"]
cmd += (
["--tag-build=dev" + datetime.datetime.now().strftime("%Y%m%d%H%M%S")]
if version_type in ("version_branch", "rebuild")
else []
)
cmd.append("bdist_wheel")

dist = os.path.join(cwd, 'dist')
if not os.path.exists(dist):
os.mkdir(dist)
if os.path.exists("setup.py"):
cmd = ["python3", "./setup.py", "egg_info", "--no-date"]
cmd += (
["--tag-build=dev" + datetime.datetime.now().strftime("%Y%m%d%H%M%S")]
if version_type in ("version_branch", "rebuild")
else []
)
cmd.append("bdist_wheel")
else:
cwd = os.path.join(cwd, 'dist')
os.mkdir(cwd)
cmd = ["pip", "wheel", "--no-deps", "--wheel-dir=dist", '.']
cmd = package.get("build_command", cmd)
subprocess.check_call(cmd, cwd=cwd, env=env)
cmd = ["twine"]
cmd += ["upload", "--verbose", "--disable-progress-bar"] if publish else ["check"]
Expand Down
7 changes: 7 additions & 0 deletions c2cciutils/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,13 @@
"path": {
"description": "The path of the pypi package",
"type": "string"
},
"build_command": {
"description": "The command used to do the build",
"type": "array",
"items": {
"type": "string"
}
}
}
}
Expand Down

0 comments on commit 48e35fd

Please sign in to comment.