11
2- # Version: 0.17
2+ # Version: 0.18-1
33
44"""The Versioneer - like a rocketeer, but for versions.
55
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/)
151151software (exactly equal to a known tag), the identifier will only contain the
152152stripped 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):
364364class NotThisMethod (Exception ):
365365 """Exception raised if a method is not valid for the current scenario."""
366366
367+
367368# these dictionaries contain VCS-specific tools
368369LONG_VERSION_PY = {}
369370HANDLERS = {}
@@ -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+
418421LONG_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+
11791183SHORT_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+
18111841if __name__ == "__main__" :
18121842 cmd = sys .argv [1 ]
18131843 if cmd == "setup" :
0 commit comments