Skip to content

Commit a736b9e

Browse files
committed
Drop setuptools_scm in favour of git-props
1 parent a43bc63 commit a736b9e

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

.github/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
distutils-pytest
2+
git-props
23
pathlib ; python_version == '2.7'
34
pytest >=3.7.0
4-
setuptools_scm
5+
setuptools

README.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ System requirements
3737

3838
Optional library packages:
3939

40-
+ `setuptools_scm`_
40+
+ `git-props`_
4141

42-
The version number is managed using this package. All source
43-
distributions add a static text file with the version number and
44-
fall back using that if `setuptools_scm` is not available. So this
45-
package is only needed to build out of the plain development source
46-
tree as cloned from GitHub.
42+
This package is used to extract some metadata such as the version
43+
number out of git, the version control system. All releases embed
44+
that metadata in the distribution. So this package is only needed
45+
to build out of the plain development source tree as cloned from
46+
GitHub, but not to build a release distribution.
4747

4848
+ `distutils-pytest`_ >= 0.2
4949

@@ -105,6 +105,6 @@ permissions and limitations under the License.
105105
.. _PyPI site: https://pypi.org/project/pytest-dependency/
106106
.. _setuptools: http://pypi.python.org/pypi/setuptools/
107107
.. _pytest: http://pytest.org/
108-
.. _setuptools_scm: https://github.com/pypa/setuptools_scm/
108+
.. _git-props: https://github.com/RKrahl/git-props
109109
.. _distutils-pytest: https://github.com/RKrahl/distutils-pytest
110110
.. _Read the Docs site: https://pytest-dependency.readthedocs.io/

setup.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@
2121
except (ImportError, AttributeError):
2222
cmdclass = dict()
2323
try:
24-
import setuptools_scm
25-
version = setuptools_scm.get_version()
24+
import gitprops
25+
release = str(gitprops.get_last_release())
26+
version = str(gitprops.get_version())
2627
except (ImportError, LookupError):
2728
try:
28-
from _meta import version
29+
from _meta import release, version
2930
except ImportError:
3031
log.warn("warning: cannot determine version number")
31-
version = "UNKNOWN"
32+
release = version = "UNKNOWN"
3233

3334
docstring = __doc__
3435

@@ -75,6 +76,7 @@ class meta(setuptools.Command):
7576
description = "generate meta files"
7677
user_options = []
7778
meta_template = '''
79+
release = "%(release)s"
7880
version = "%(version)s"
7981
'''
8082
def initialize_options(self):
@@ -85,6 +87,7 @@ def run(self):
8587
version = self.distribution.get_version()
8688
log.info("version: %s", version)
8789
values = {
90+
'release': release,
8891
'version': version,
8992
}
9093
with Path("_meta.py").open("wt") as f:
@@ -136,7 +139,8 @@ def run(self):
136139
project_urls = dict(
137140
Documentation="https://pytest-dependency.readthedocs.io/",
138141
Source="https://github.com/RKrahl/pytest-dependency",
139-
Download="https://github.com/RKrahl/pytest-dependency/releases/latest",
142+
Download=("https://github.com/RKrahl/pytest-dependency/releases/%s/"
143+
% release),
140144
),
141145
package_dir = {"": "src"},
142146
python_requires = ">=3.4",

0 commit comments

Comments
 (0)