Skip to content

Commit 7d4bd57

Browse files
author
Pan
committed
Add bdist_ext functionality to versioneer.
1 parent 088b1f7 commit 7d4bd57

File tree

3 files changed

+45
-7
lines changed

3 files changed

+45
-7
lines changed

Changelog.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Change Log
22
============
33

4+
1.3.2
5+
++++++
6+
7+
Fixes
8+
-------
9+
10+
* Binary wheels would have bad version info and require `git` for installation.
11+
412
1.3.1
513
++++++
614

pssh/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# that just contains the computed version number.
77

88
# This file is released into the public domain. Generated by
9-
# versioneer-0.17 (https://github.com/warner/python-versioneer)
9+
# versioneer-0.18 (https://github.com/warner/python-versioneer)
1010

1111
"""Git implementation of _version.py."""
1212

versioneer.py

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# Version: 0.17
2+
# Version: 0.18-1
33

44
"""The Versioneer - like a rocketeer, but for versions.
55
@@ -10,7 +10,7 @@
1010
* https://github.com/warner/python-versioneer
1111
* Brian Warner
1212
* License: Public Domain
13-
* Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, 3.5, and pypy
13+
* Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6, and pypy
1414
* [![Latest Version]
1515
(https://pypip.in/version/versioneer/badge.svg?style=flat)
1616
](https://pypi.python.org/pypi/versioneer/)
@@ -151,8 +151,8 @@
151151
software (exactly equal to a known tag), the identifier will only contain the
152152
stripped tag, e.g. "0.11".
153153
154-
Other styles are available. See details.md in the Versioneer source tree for
155-
descriptions.
154+
Other styles are available. See [details.md](details.md) in the Versioneer
155+
source tree for descriptions.
156156
157157
## Debugging
158158
@@ -364,6 +364,7 @@ def get(parser, name):
364364
class NotThisMethod(Exception):
365365
"""Exception raised if a method is not valid for the current scenario."""
366366

367+
367368
# these dictionaries contain VCS-specific tools
368369
LONG_VERSION_PY = {}
369370
HANDLERS = {}
@@ -415,6 +416,8 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
415416
print("stdout was %s" % stdout)
416417
return None, p.returncode
417418
return stdout, p.returncode
419+
420+
418421
LONG_VERSION_PY['git'] = '''
419422
# This file helps to compute a version number in source trees obtained from
420423
# git-archive tarball (such as those provided by githubs download-from-tag
@@ -423,7 +426,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
423426
# that just contains the computed version number.
424427
425428
# This file is released into the public domain. Generated by
426-
# versioneer-0.17 (https://github.com/warner/python-versioneer)
429+
# versioneer-0.18 (https://github.com/warner/python-versioneer)
427430
428431
"""Git implementation of _version.py."""
429432
@@ -1176,8 +1179,9 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):
11761179
(str(rootdirs), parentdir_prefix))
11771180
raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
11781181

1182+
11791183
SHORT_VERSION_PY = """
1180-
# This file was generated by 'versioneer.py' (0.17) from
1184+
# This file was generated by 'versioneer.py' (0.18) from
11811185
# revision-control system data, or from the parent directory name of an
11821186
# unpacked source archive. Distribution tarballs contain a pre-generated copy
11831187
# of this file.
@@ -1555,6 +1559,31 @@ def run(self):
15551559
write_to_version_file(target_versionfile, versions)
15561560
cmds["build_py"] = cmd_build_py
15571561

1562+
if "setuptools" in sys.modules:
1563+
from setuptools.command.build_ext import build_ext as _build_ext
1564+
else:
1565+
from distutils.command.build_ext import build_ext as _build_ext
1566+
1567+
class cmd_build_ext(_build_ext):
1568+
def run(self):
1569+
root = get_root()
1570+
cfg = get_config_from_root(root)
1571+
versions = get_versions()
1572+
_build_ext.run(self)
1573+
if self.inplace:
1574+
# build_ext --inplace will only build modules in
1575+
# build/lib<..> dir with no _version.py to write to.
1576+
# As in place builds will already have a _version.py
1577+
# in the module dir, we do not need to write one.
1578+
return
1579+
# now locate _version.py in the new build/ directory and replace
1580+
# it with an updated value
1581+
target_versionfile = os.path.join(self.build_lib,
1582+
cfg.versionfile_source)
1583+
print("UPDATING %s" % target_versionfile)
1584+
write_to_version_file(target_versionfile, versions)
1585+
cmds["build_ext"] = cmd_build_ext
1586+
15581587
if "cx_Freeze" in sys.modules: # cx_freeze enabled?
15591588
from cx_Freeze.dist import build_exe as _build_exe
15601589
# nczeczulin reports that py2exe won't like the pep440-style string
@@ -1808,6 +1837,7 @@ def scan_setup_py():
18081837
errors += 1
18091838
return errors
18101839

1840+
18111841
if __name__ == "__main__":
18121842
cmd = sys.argv[1]
18131843
if cmd == "setup":

0 commit comments

Comments
 (0)