From 37a36d11da3576a405e94bc6f1928764749c4efe Mon Sep 17 00:00:00 2001 From: Ilia Feldgun Date: Tue, 6 Apr 2021 19:17:31 +0300 Subject: [PATCH] Added setup.py PEP-440 versioning with git cli Readme --- .gitignore | 3 ++- README.md | 17 +++++++++++++++++ setup.py | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 README.md create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 9ad8b7b..8e45810 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,9 @@ *.swp build dist -rackattack.egg-info +rackattack_api.egg-info images.fortests .coverage attic .idea/ +.vscode/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..e095c28 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# Rackattack API +API for provisioning rackattack hosts + + +```python +from rackattack.ssh import connection + +def get_connection(ip, username, password, timeout=5 * 60): + node = connection.Connection(ip, username, password) + node.waitForTCPServer(timeout=timeout, interval=60) + node.connect() + return node + +node = get_connection("192.168.1.1", "root", "password") +date = node.run.script("date") + +``` \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..6a73f2e --- /dev/null +++ b/setup.py @@ -0,0 +1,41 @@ +import setuptools +import subprocess +import re + + +def version(): + git_describe_cmd = ["git", "describe", "--tags", "HEAD"] + git_head_tag = subprocess.check_output(git_describe_cmd).strip().decode("utf-8") + python_version = git_head_tag + unofficial_tag = re.search(r"(?=.*)-(\d+)-", python_version) + if unofficial_tag: + pep_440_suffix = ".dev{}+".format(unofficial_tag.group(1)) + python_version = python_version.replace(unofficial_tag.group(0), pep_440_suffix) + return python_version + + +with open("README.md", "r") as fh: + long_description = fh.read() + +setuptools.setup( + name="rackattack_api", + packages=setuptools.find_packages(where="py"), + package_dir={"": "py"}, + version=version(), + python_requires="<=2.7.18", + install_requires=["twisted", "greenlet"], + author="Stratoscale", + author_email="zcompute@zadarastorage.com", + description="API for provisioning rackattack hosts", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/Stratoscale/rackattack-api", + project_urls={ + "Bug Tracker": "https://github.com/Stratoscale/rackattack-api/issues", + }, + classifiers=[ + "Programming Language :: Python :: 2", + "License :: Apache License 2.0", + "Operating System :: OS Independent", + ], +)