|
3 | 3 | https://packaging.python.org/en/latest/distributing.html |
4 | 4 | https://github.com/pypa/sampleproject |
5 | 5 | """ |
6 | | -from six import raise_from |
7 | 6 | from os import path |
8 | | - |
| 7 | +import pkg_resources |
9 | 8 | from setuptools import setup, find_packages |
10 | 9 |
|
| 10 | +pkg_resources.require("setuptools>=39.2") |
| 11 | +pkg_resources.require("setuptools_scm") |
| 12 | + |
| 13 | +from setuptools_scm import get_version # noqa: E402 |
| 14 | + |
11 | 15 | here = path.abspath(path.dirname(__file__)) |
12 | 16 |
|
13 | 17 | # Check that code generation has been run, otherwise run it |
|
31 | 35 | # *************** Dependencies ********* |
32 | 36 | INSTALL_REQUIRES = [] |
33 | 37 | DEPENDENCY_LINKS = [] |
34 | | -SETUP_REQUIRES = ['pytest-runner', 'setuptools_scm', 'pypandoc', 'pandoc', 'ordered-set', 'mako', 'six'] |
35 | | -TESTS_REQUIRE = ['pytest', 'pytest-logging', 'pytest-cov', 'numpy', 'pandas'] |
| 38 | +SETUP_REQUIRES = ['pytest-runner', 'setuptools_scm', 'ordered-set', 'mako'] |
| 39 | +TESTS_REQUIRE = ['pytest', 'numpy', 'pandas'] |
36 | 40 | EXTRAS_REQUIRE = {} |
37 | 41 |
|
38 | | -# simple check |
39 | | -try: |
40 | | - from setuptools_scm import get_version |
41 | | -except Exception as e: |
42 | | - raise_from(Exception('Required packages for setup not found. Please install `setuptools_scm`'), e) |
43 | | - |
44 | 42 | # ************** ID card ***************** |
45 | 43 | DISTNAME = 'mini_lambda' |
46 | 44 | DESCRIPTION = 'Simple lambda functions without `lambda x:` and with string conversion capability.' |
47 | 45 | MAINTAINER = 'Sylvain MARIE' |
48 | 46 | MAINTAINER_EMAIL = 'sylvain.marie@schneider-electric.com' |
49 | 47 | URL = 'https://github.com/smarie/python-mini-lambda' |
| 48 | +DOWNLOAD_URL = URL + '/tarball/' + get_version() |
50 | 49 | LICENSE = 'BSD 3-Clause' |
51 | 50 | LICENSE_LONG = 'License :: OSI Approved :: BSD License' |
52 | | - |
53 | | -version_for_download_url = get_version() |
54 | | -DOWNLOAD_URL = URL + '/tarball/' + version_for_download_url |
55 | | - |
56 | 51 | KEYWORDS = 'mini minimal lambda expr expression simple print string func function symbol symbolic' |
57 | 52 |
|
58 | 53 | with open(path.join(here, 'docs', 'long_description.md')) as f: |
59 | 54 | LONG_DESCRIPTION = f.read() |
60 | 55 |
|
61 | | -# ************* VERSION ************** |
62 | | -# --Get the Version number from VERSION file, see https://packaging.python.org/single_source_version/ option 4. |
63 | | -# THIS IS DEPRECATED AS WE NOW USE GIT TO MANAGE VERSION |
64 | | -# with open(path.join(here, 'VERSION')) as version_file: |
65 | | -# VERSION = version_file.read().strip() |
66 | | -# OBSOLETES = [] |
67 | | - |
68 | 56 | setup( |
69 | 57 | name=DISTNAME, |
70 | 58 | description=DESCRIPTION, |
|
109 | 97 | 'Programming Language :: Python :: 3.5', |
110 | 98 | 'Programming Language :: Python :: 3.6', |
111 | 99 | 'Programming Language :: Python :: 3.7', |
| 100 | + |
| 101 | + # 'Framework :: Pytest' |
112 | 102 | ], |
113 | 103 |
|
114 | 104 | # What does your project relate to? |
115 | 105 | keywords=KEYWORDS, |
116 | 106 |
|
117 | 107 | # You can just specify the packages manually here if your project is |
118 | 108 | # simple. Or you can use find_packages(). |
119 | | - packages=find_packages(exclude=['contrib', 'docs', 'tests']), |
| 109 | + packages=find_packages(exclude=['contrib', 'docs', '*tests*']), |
120 | 110 |
|
121 | 111 | # Alternatively, if you want to distribute just a my_module.py, uncomment |
122 | 112 | # this: |
|
151 | 141 | # have to be included in MANIFEST.in as well. |
152 | 142 | # Note: we use the empty string so that this also works with submodules |
153 | 143 | package_data={"": ['py.typed', '*.pyi']}, |
| 144 | + # IMPORTANT: DO NOT set the `include_package_data` flag !! It triggers inclusion of all git-versioned files |
| 145 | + # see https://github.com/pypa/setuptools_scm/issues/190#issuecomment-351181286 |
| 146 | + # include_package_data=True, |
154 | 147 |
|
155 | 148 | # Although 'package_data' is the preferred approach, in some case you may |
156 | 149 | # need to place data files outside of your packages. See: |
|
0 commit comments