|
4 | 4 | import os |
5 | 5 | import re |
6 | 6 |
|
| 7 | +# source path for the class' package. Amend if necessary |
| 8 | +PACKAGE_SOURCE_DIR = "path/to/class/directorz" |
| 9 | + |
| 10 | +# Amend this section with your custom data |
| 11 | +PACKAGE_NAME="package-name" |
| 12 | +DESCRIPTION = "package-description" |
| 13 | +AUTHOR = "author-name" |
| 14 | +AUTHOR_EMAIL = "author@email.com" |
| 15 | +URL = "https://www.url.com/to/my/repository" |
| 16 | +# https://pypi.org/classifiers/ |
| 17 | +CLASSIFIERS = [ |
| 18 | + "Intended Audience :: Developers", |
| 19 | + "Programming Language :: Python", |
| 20 | + "Programming Language :: Python :: 3", |
| 21 | + "Topic :: Software Development", |
| 22 | + "Operating System :: OS Independent", |
| 23 | + "Development Status :: 4 - Beta", |
| 24 | + "Framework :: Robot Framework", |
| 25 | +] |
| 26 | +INSTALL_REQUIRES=[ |
| 27 | + "package_1", |
| 28 | + "package_2" |
| 29 | +] |
| 30 | +KEYWORDS=[ |
| 31 | + "Notifications", |
| 32 | + "Notification Service", |
| 33 | + "Push Notifications", |
| 34 | + "Notifier", |
| 35 | + "Alerts", |
| 36 | + "Robot Framework" |
| 37 | +] |
| 38 | +LICENSE="GNU General Public License v3 (GPLv3)" |
| 39 | + |
| 40 | +def running_in_a_github_action(): |
| 41 | + return os.getenv("GITHUB_ACTIONS") == "true" |
| 42 | + |
7 | 43 | if __name__ == "__main__": |
8 | | - # get README gnd use as long description |
| 44 | + # get README and use it as long description |
9 | 45 | with open("README.md", "r") as fh: |
10 | | - long_description = fh.read() |
| 46 | + LONG_DESCRIPTION = fh.read() |
11 | 47 |
|
12 | | - # get VERSION value from Github workflow and terminate workflow if value is None |
13 | | - VERSION = os.getenv("GITHUB_PROGRAM_VERSION") |
14 | | - if not VERSION: |
15 | | - raise ValueError("Did not receive version info from GitHub") |
16 | | - |
17 | | - # Amend with your project information |
| 48 | + GITHUB_PROGRAM_VERSION = "" |
| 49 | + |
| 50 | + if running_in_a_github_action(): |
| 51 | + # Only run this branch if we are part of a Github action. Otherwise, just skip |
| 52 | + # it as we won't be able to get the version info from Github anyway |
| 53 | + # |
| 54 | + # get VERSION value from Github workflow and terminate workflow if value is None |
| 55 | + GITHUB_PROGRAM_VERSION = os.getenv("GITHUB_PROGRAM_VERSION") |
| 56 | + if not GITHUB_PROGRAM_VERSION: |
| 57 | + raise ValueError("Did not receive release label version info from GitHub") |
| 58 | + else: |
| 59 | + if len(GITHUB_PROGRAM_VERSION == 0): |
| 60 | + raise ValueError("Manual run requires a manually set GITHUB_PROGRAM_VERSION; change setup.py accordingly") |
| 61 | + |
| 62 | + # Main setup branch |
18 | 63 | setup( |
19 | | - name="my package name", |
20 | | - version=VERSION, |
21 | | - description="my description", |
22 | | - long_description=long_description, |
| 64 | + name=PACKAGE_NAME, |
| 65 | + version=GITHUB_PROGRAM_VERSION, |
| 66 | + description=DESCRIPTION, |
| 67 | + long_description=LONG_DESCRIPTION, |
23 | 68 | long_description_content_type="text/markdown", |
24 | | - author="My Name", |
25 | | - author_email="My email addresse", |
26 | | - url="URL to my repo", |
27 | | - packages=find_packages(), |
| 69 | + author=AUTHOR, |
| 70 | + author_email=AUTHOR_EMAIL, |
| 71 | + url=URL, |
| 72 | + packages=find_packages(where=PACKAGE_SOURCE_DIR), |
28 | 73 | include_package_data=True, |
29 | | - classifiers=[ |
30 | | - "Intended Audience :: Developers", |
31 | | - "Programming Language :: Python", |
32 | | - "Programming Language :: Python :: 3", |
33 | | - "Topic :: Software Development", |
34 | | - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", |
35 | | - "Operating System :: OS Independent", |
36 | | - "Development Status :: 4 - Beta", |
37 | | - "Framework :: Robot Framework", |
38 | | - ], |
39 | | - license="GNU General Public License v3 (GPLv3)", |
40 | | - install_requires=["my_packet_1", "my_packet_2"], |
41 | | - keywords=["My Keyword 1", "My Keyword 2"], |
| 74 | + classifiers=CLASSIFIERS, |
| 75 | + license=LICENSE, |
| 76 | + install_requires=INSTALL_REQUIRES, |
| 77 | + keywords=KEYWORDS, |
42 | 78 | ) |
43 | | - |
|
0 commit comments