|
11 | 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
12 | 12 | # License for the specific language governing permissions and limitations
|
13 | 13 | # under the License.
|
14 |
| -from pypi_packaging import pypi_config |
15 |
| - |
16 | 14 | from setuptools import setup, find_packages
|
17 | 15 |
|
| 16 | +import os |
| 17 | +import codecs |
18 | 18 | import pathlib
|
19 | 19 |
|
20 | 20 |
|
| 21 | +def read(rel_path): |
| 22 | + here = os.path.abspath(os.path.dirname(__file__)) |
| 23 | + with codecs.open(os.path.join(here, rel_path), "r") as fp: |
| 24 | + return fp.read() |
| 25 | + |
| 26 | + |
| 27 | +def get_version(rel_path): |
| 28 | + for line in read(rel_path).splitlines(): |
| 29 | + if line.startswith("__version__"): |
| 30 | + delim = '"' if '"' in line else "'" |
| 31 | + return line.split(delim)[1] |
| 32 | + else: |
| 33 | + raise RuntimeError("Unable to find version string.") |
| 34 | + |
| 35 | + |
| 36 | +# FORMAT: 1.x.x |
| 37 | +pypi_config = { |
| 38 | + "version_target": get_version("cloudevents/__init__.py"), |
| 39 | + "package_name": "cloudevents", |
| 40 | +} |
| 41 | + |
21 | 42 | here = pathlib.Path(__file__).parent.resolve()
|
22 | 43 | long_description = (here / "README.md").read_text(encoding="utf-8")
|
23 | 44 |
|
24 |
| -setup( |
25 |
| - name=pypi_config["package_name"], |
26 |
| - summary="CloudEvents SDK Python", |
27 |
| - long_description_content_type="text/markdown", |
28 |
| - long_description=long_description, |
29 |
| - author="The Cloud Events Contributors", |
30 |
| - author_email="cncfcloudevents@gmail.com", |
31 |
| - home_page="https://cloudevents.io", |
32 |
| - classifiers=[ |
33 |
| - "Intended Audience :: Information Technology", |
34 |
| - "Intended Audience :: System Administrators", |
35 |
| - "License :: OSI Approved :: Apache Software License", |
36 |
| - "Operating System :: POSIX :: Linux", |
37 |
| - "Programming Language :: Python :: 3", |
38 |
| - "Programming Language :: Python :: 3.6", |
39 |
| - "Programming Language :: Python :: 3.7", |
40 |
| - "Programming Language :: Python :: 3.8", |
41 |
| - "Programming Language :: Python :: 3.9", |
42 |
| - "Programming Language :: Python :: 3.10", |
43 |
| - ], |
44 |
| - packages=find_packages(exclude=["cloudevents.tests"]), |
45 |
| - version=pypi_config["version_target"], |
46 |
| - install_requires=["deprecation>=2.0,<3.0"], |
47 |
| -) |
| 45 | +if __name__ == "__main__": |
| 46 | + setup( |
| 47 | + name=pypi_config["package_name"], |
| 48 | + summary="CloudEvents SDK Python", |
| 49 | + long_description_content_type="text/markdown", |
| 50 | + long_description=long_description, |
| 51 | + author="The Cloud Events Contributors", |
| 52 | + author_email="cncfcloudevents@gmail.com", |
| 53 | + home_page="https://cloudevents.io", |
| 54 | + classifiers=[ |
| 55 | + "Intended Audience :: Information Technology", |
| 56 | + "Intended Audience :: System Administrators", |
| 57 | + "License :: OSI Approved :: Apache Software License", |
| 58 | + "Operating System :: POSIX :: Linux", |
| 59 | + "Programming Language :: Python :: 3", |
| 60 | + "Programming Language :: Python :: 3.6", |
| 61 | + "Programming Language :: Python :: 3.7", |
| 62 | + "Programming Language :: Python :: 3.8", |
| 63 | + "Programming Language :: Python :: 3.9", |
| 64 | + "Programming Language :: Python :: 3.10", |
| 65 | + ], |
| 66 | + packages=find_packages(exclude=["cloudevents.tests"]), |
| 67 | + version=pypi_config["version_target"], |
| 68 | + install_requires=["deprecation>=2.0,<3.0"], |
| 69 | + ) |
0 commit comments