|
2 | 2 | """
|
3 | 3 | pip setup file
|
4 | 4 | """
|
5 |
| -from pyclickup.globals import __version__, LIBRARY |
6 | 5 | from setuptools import setup, find_packages
|
7 | 6 |
|
| 7 | +LIBRARY = 'pyclickup' |
| 8 | + |
8 | 9 |
|
9 | 10 | with open("README.rst") as readme:
|
10 | 11 | long_description = readme.read()
|
11 | 12 |
|
12 | 13 |
|
| 14 | +with open("requirements.txt") as requirements: |
| 15 | + install_requires = requirements.read().split("\n") |
| 16 | + install_requires = [x.strip() for x in install_requires if x.strip()] |
| 17 | + |
| 18 | + |
| 19 | +def find_version(*file_paths): |
| 20 | + import os |
| 21 | + import re |
| 22 | + """ |
| 23 | + This pattern was modeled on a method from the Python Packaging User Guide: |
| 24 | + https://packaging.python.org/en/latest/single_source_version.html |
| 25 | + We read instead of importing so we don't get import errors if our code |
| 26 | + imports from dependencies listed in install_requires. |
| 27 | + """ |
| 28 | + base_module_file = os.path.join(*file_paths) |
| 29 | + with open(base_module_file) as f: |
| 30 | + base_module_data = f.read() |
| 31 | + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", |
| 32 | + base_module_data, re.M) |
| 33 | + if version_match: |
| 34 | + return version_match.group(1) |
| 35 | + raise RuntimeError("Unable to find version string.") |
| 36 | + |
| 37 | + |
13 | 38 | setup(
|
14 | 39 | name=LIBRARY,
|
15 |
| - version=__version__, |
| 40 | + version=find_version('pyclickup', 'globals.py'), |
16 | 41 | description="A python wrapper for the ClickUp API",
|
17 | 42 | long_description=long_description,
|
18 | 43 | author="Jacobi Petrucciani",
|
|
22 | 47 | download_url="https://github.com/jpetrucciani/{}.git".format(LIBRARY),
|
23 | 48 | license="LICENSE",
|
24 | 49 | packages=find_packages(),
|
| 50 | + install_requires=install_requires, |
25 | 51 | classifiers=[
|
26 | 52 | "Programming Language :: Python :: 3",
|
27 | 53 | "Programming Language :: Python :: 3.5",
|
|
0 commit comments