|
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 |
|
11 | | -here = path.abspath(path.dirname(__file__)) |
| 10 | +pkg_resources.require("setuptools>=39.2") |
| 11 | +pkg_resources.require("setuptools_scm") |
| 12 | + |
| 13 | +from setuptools_scm import get_version # noqa: E402 |
12 | 14 |
|
13 | 15 | # *************** Dependencies ********* |
14 | 16 | INSTALL_REQUIRES = ['stdlib_list', 'setuptools_scm', 'functools32;python_version<"3.2"', |
|
21 | 23 | ] |
22 | 24 | EXTRAS_REQUIRE = {} |
23 | 25 |
|
24 | | -# simple check |
25 | | -try: |
26 | | - from setuptools_scm import get_version |
27 | | -except Exception as e: |
28 | | - raise_from(Exception('Required packages for setup not found. Please install `setuptools_scm`'), e) |
29 | | - |
30 | 26 | # ************** ID card ***************** |
31 | 27 | DISTNAME = 'getversion' |
32 | 28 | DESCRIPTION = 'Get the version number of any python module or package, reliably.' |
33 | 29 | MAINTAINER = 'Sylvain MARIE' |
34 | 30 | MAINTAINER_EMAIL = '[email protected]' |
35 | 31 | URL = 'https://github.com/smarie/python-getversion' |
| 32 | +DOWNLOAD_URL = URL + '/tarball/' + get_version() |
36 | 33 | LICENSE = 'BSD 3-Clause' |
37 | 34 | LICENSE_LONG = 'License :: OSI Approved :: BSD License' |
38 | | - |
39 | | -version_for_download_url = get_version() |
40 | | -DOWNLOAD_URL = URL + '/tarball/' + version_for_download_url |
41 | | - |
42 | 35 | KEYWORDS = 'module version source binary package library PEP345 PEP396 PEP427 pkg_resources setuptools wheel egg ' \ |
43 | 36 | 'egg-info scm git svn' |
44 | 37 |
|
| 38 | +here = path.abspath(path.dirname(__file__)) |
45 | 39 | with open(path.join(here, 'docs', 'long_description.md')) as f: |
46 | 40 | LONG_DESCRIPTION = f.read() |
47 | 41 |
|
48 | | -# ************* VERSION ************** |
49 | | -# --Get the Version number from VERSION file, see https://packaging.python.org/single_source_version/ option 4. |
50 | | -# THIS IS DEPRECATED AS WE NOW USE GIT TO MANAGE VERSION |
51 | | -# with open(path.join(here, 'VERSION')) as version_file: |
52 | | -# VERSION = version_file.read().strip() |
53 | 42 | # OBSOLETES = [] |
54 | 43 |
|
55 | 44 | setup( |
|
105 | 94 |
|
106 | 95 | # You can just specify the packages manually here if your project is |
107 | 96 | # simple. Or you can use find_packages(). |
108 | | - packages=find_packages(exclude=['contrib', 'docs', 'tests']), |
| 97 | + packages=find_packages(exclude=['contrib', 'docs', '*tests*']), |
109 | 98 |
|
110 | 99 | # Alternatively, if you want to distribute just a my_module.py, uncomment |
111 | 100 | # this: |
|
138 | 127 | # If there are data files included in your packages that need to be |
139 | 128 | # installed, specify them here. If using Python 2.6 or less, then these |
140 | 129 | # have to be included in MANIFEST.in as well. |
141 | | - # package_data={ |
142 | | - # 'sample': ['package_data.dat'], |
143 | | - # }, |
| 130 | + # Note: we use the empty string so that this also works with submodules |
| 131 | + package_data={"": ['py.typed', '*.pyi']}, |
| 132 | + # IMPORTANT: DO NOT set the `include_package_data` flag !! It triggers inclusion of all git-versioned files |
| 133 | + # see https://github.com/pypa/setuptools_scm/issues/190#issuecomment-351181286 |
| 134 | + # include_package_data=True, |
144 | 135 |
|
145 | 136 | # Although 'package_data' is the preferred approach, in some case you may |
146 | 137 | # need to place data files outside of your packages. See: |
|
0 commit comments