|
1 | 1 | # ------------------------------------------------------------------------- |
2 | | -# Copyright (c) 2020, PTC Inc. and/or all its affiliates. All rights reserved. |
| 2 | +# Copyright (c) PTC Inc. and/or all its affiliates. All rights reserved. |
3 | 3 | # See License.txt in the project root for |
4 | 4 | # license information. |
5 | 5 | # -------------------------------------------------------------------------- |
6 | 6 |
|
| 7 | +# Package Setup Script - run this to build the package |
| 8 | +# Usage - python setup.py <build> sdist bdist_wheel |
| 9 | +# Example: python setup.py 1.0.0 sdist bdist_wheel |
| 10 | + |
7 | 11 | import setuptools |
8 | | -import sys |
| 12 | +import pathlib, os |
| 13 | + |
| 14 | +def read(rel_path): |
| 15 | + # type: (str) -> str |
| 16 | + here = os.path.abspath(os.path.dirname(__file__)) |
| 17 | + # intentionally *not* adding an encoding option to open, See: |
| 18 | + # https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690 |
| 19 | + with open(os.path.join(here, rel_path)) as fp: |
| 20 | + return fp.read() |
| 21 | + |
| 22 | +def get_version(rel_path): |
| 23 | + # type: (str) -> str |
| 24 | + for line in read(rel_path).splitlines(): |
| 25 | + if line.startswith('__version__'): |
| 26 | + # __version__ = "0.9" |
| 27 | + delim = '"' if '"' in line else "'" |
| 28 | + return line.split(delim)[1] |
| 29 | + raise RuntimeError("Unable to find version string.") |
9 | 30 |
|
10 | | -with open("README.md", "r") as fh: |
11 | | - long_description = fh.read() |
| 31 | +here = pathlib.Path(__file__).parent.resolve() |
12 | 32 |
|
13 | | -print("Arguments list: ", str(sys.argv)) |
14 | | -if len(sys.argv) < 4: |
15 | | - print("Not enough arguments. Arguments list: ", str(sys.argv)) |
16 | | -else: |
17 | | - version = sys.argv[1] |
18 | | - sys.argv.pop(1) |
19 | | - setuptools.setup( |
20 | | - name="kepconfig", |
21 | | - version= version, |
22 | | - author="PTC Inc", |
23 | | - # author_email="author@example.com", |
| 33 | +# Get the long description from the README file |
| 34 | +long_description = (here / 'README.md').read_text(encoding='utf-8') |
24 | 35 |
|
25 | | - description="SDK package for Kepware Configuration API", |
26 | | - keywords="Kepware OPC Configuration Thingworx", |
27 | | - long_description=long_description, |
28 | | - long_description_content_type="text/markdown", |
29 | | - url="TBD", |
30 | | - project_urls={}, |
31 | | - packages=setuptools.find_packages(), |
32 | | - classifiers=[ |
33 | | - "Development Status :: 4 - Beta", |
34 | | - 'License :: OSI Approved :: MIT License', |
35 | | - "Programming Language :: Python :: 3", |
36 | | - "Operating System :: OS Independent", |
37 | | - "Intended Audience :: Manufacturing", |
38 | | - ], |
39 | | - python_requires='>=3.6', |
40 | | - ) |
| 36 | +setuptools.setup( |
| 37 | + name="kepconfig", |
| 38 | + version= get_version("kepconfig/__init__.py"), |
| 39 | + author="PTC Inc", |
| 40 | + description="SDK package for Kepware Configuration API", |
| 41 | + keywords="Kepware, OPC, Configuration, Thingworx", |
| 42 | + license="MIT License", |
| 43 | + long_description=long_description, |
| 44 | + long_description_content_type="text/markdown", |
| 45 | + url="https://github.com/PTCInc/Kepware-ConfigAPI-SDK-Python", |
| 46 | + project_urls={}, |
| 47 | + packages=setuptools.find_packages(), |
| 48 | + classifiers=[ |
| 49 | + "Development Status :: 5 - Production/Stable", |
| 50 | + "License :: OSI Approved :: MIT License", |
| 51 | + "Programming Language :: Python", |
| 52 | + "Programming Language :: Python :: 3", |
| 53 | + "Operating System :: OS Independent", |
| 54 | + "Intended Audience :: Manufacturing", |
| 55 | + "Intended Audience :: Developers", |
| 56 | + ], |
| 57 | + python_requires='>=3.6', |
| 58 | +) |
0 commit comments