mirror of
https://github.com/dtomlinson91/panaetius.git
synced 2025-12-22 04:55:44 +00:00
bumping to v2.3.2
This commit is contained in:
34
duties.py
34
duties.py
@@ -139,3 +139,37 @@ def export(ctx):
|
||||
|
||||
with requirements_dev.open("w", encoding="utf-8") as req:
|
||||
req.write(requirements_dev_content)
|
||||
|
||||
|
||||
@duty
|
||||
def publish(ctx, password:str):
|
||||
"""
|
||||
Publish the package to pypi.org.
|
||||
|
||||
Args:
|
||||
password (str): pypi.org password.
|
||||
|
||||
Example:
|
||||
`duty publish password=$my_password`
|
||||
"""
|
||||
dist_dir = pathlib.Path(".") / "dist"
|
||||
rm_result = rm_tree(dist_dir)
|
||||
print(rm_result)
|
||||
|
||||
publish_result = ctx.run(["poetry", "publish", "-u", "dtomlinson", "-p", password, "--build"])
|
||||
print(publish_result)
|
||||
|
||||
|
||||
def rm_tree(directory: pathlib.Path):
|
||||
"""
|
||||
Recursively delete a directory and all its contents.
|
||||
|
||||
Args:
|
||||
directory (pathlib.Path): The directory to delete.
|
||||
"""
|
||||
for child in directory.glob('*'):
|
||||
if child.is_file():
|
||||
child.unlink()
|
||||
else:
|
||||
rm_tree(child)
|
||||
directory.rmdir()
|
||||
|
||||
Reference in New Issue
Block a user