|
1 | 1 |
|
2 |
| -# Version: 0.26 |
| 2 | +# Version: 0.28 |
3 | 3 |
|
4 | 4 | """The Versioneer - like a rocketeer, but for versions.
|
5 | 5 |
|
|
30 | 30 | ### Vendored mode
|
31 | 31 |
|
32 | 32 | * `pip install versioneer` to somewhere in your $PATH
|
33 |
| -* add a `[tool.versioneer]` section to your `pyproject.toml or a |
| 33 | + * A [conda-forge recipe](https://github.com/conda-forge/versioneer-feedstock) is |
| 34 | + available, so you can also use `conda install -c conda-forge versioneer` |
| 35 | +* add a `[tool.versioneer]` section to your `pyproject.toml` or a |
34 | 36 | `[versioneer]` section to your `setup.cfg` (see [Install](INSTALL.md))
|
| 37 | + * Note that you will need to add `tomli; python_version < "3.11"` to your |
| 38 | + build-time dependencies if you use `pyproject.toml` |
35 | 39 | * run `versioneer install --vendor` in your source tree, commit the results
|
36 | 40 | * verify version information with `python setup.py version`
|
37 | 41 |
|
38 | 42 | ### Build-time dependency mode
|
39 | 43 |
|
40 | 44 | * `pip install versioneer` to somewhere in your $PATH
|
41 |
| -* add a `[tool.versioneer]` section to your `pyproject.toml or a |
| 45 | + * A [conda-forge recipe](https://github.com/conda-forge/versioneer-feedstock) is |
| 46 | + available, so you can also use `conda install -c conda-forge versioneer` |
| 47 | +* add a `[tool.versioneer]` section to your `pyproject.toml` or a |
42 | 48 | `[versioneer]` section to your `setup.cfg` (see [Install](INSTALL.md))
|
43 |
| -* add `versioneer` to the `requires` key of the `build-system` table in |
44 |
| - `pyproject.toml`: |
| 49 | +* add `versioneer` (with `[toml]` extra, if configuring in `pyproject.toml`) |
| 50 | + to the `requires` key of the `build-system` table in `pyproject.toml`: |
45 | 51 | ```toml
|
46 | 52 | [build-system]
|
47 |
| - requires = ["setuptools", "versioneer"] |
| 53 | + requires = ["setuptools", "versioneer[toml]"] |
48 | 54 | build-backend = "setuptools.build_meta"
|
49 | 55 | ```
|
50 | 56 | * run `versioneer install --no-vendor` in your source tree, commit the results
|
|
286 | 292 |
|
287 | 293 | To make Versioneer easier to embed, all its code is dedicated to the public
|
288 | 294 | domain. The `_version.py` that it creates is also in the public domain.
|
289 |
| -Specifically, both are released under the Creative Commons "Public Domain |
290 |
| -Dedication" license (CC0-1.0), as described in |
291 |
| -https://creativecommons.org/publicdomain/zero/1.0/ . |
| 295 | +Specifically, both are released under the "Unlicense", as described in |
| 296 | +https://unlicense.org/. |
292 | 297 |
|
293 | 298 | [pypi-image]: https://img.shields.io/pypi/v/versioneer.svg
|
294 | 299 | [pypi-url]: https://pypi.python.org/pypi/versioneer/
|
|
313 | 318 | from pathlib import Path
|
314 | 319 | from typing import Callable, Dict
|
315 | 320 | import functools
|
316 |
| -try: |
317 |
| - import tomli |
318 |
| - have_tomli = True |
319 |
| -except ImportError: |
320 |
| - have_tomli = False |
| 321 | + |
| 322 | +have_tomllib = True |
| 323 | +if sys.version_info >= (3, 11): |
| 324 | + import tomllib |
| 325 | +else: |
| 326 | + try: |
| 327 | + import tomli as tomllib |
| 328 | + except ImportError: |
| 329 | + have_tomllib = False |
321 | 330 |
|
322 | 331 |
|
323 | 332 | class VersioneerConfig:
|
@@ -373,12 +382,12 @@ def get_config_from_root(root):
|
373 | 382 | pyproject_toml = root / "pyproject.toml"
|
374 | 383 | setup_cfg = root / "setup.cfg"
|
375 | 384 | section = None
|
376 |
| - if pyproject_toml.exists() and have_tomli: |
| 385 | + if pyproject_toml.exists() and have_tomllib: |
377 | 386 | try:
|
378 | 387 | with open(pyproject_toml, 'rb') as fobj:
|
379 |
| - pp = tomli.load(fobj) |
| 388 | + pp = tomllib.load(fobj) |
380 | 389 | section = pp['tool']['versioneer']
|
381 |
| - except (tomli.TOMLDecodeError, KeyError): |
| 390 | + except (tomllib.TOMLDecodeError, KeyError): |
382 | 391 | pass
|
383 | 392 | if not section:
|
384 | 393 | parser = configparser.ConfigParser()
|
@@ -470,7 +479,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
|
470 | 479 | # that just contains the computed version number.
|
471 | 480 |
|
472 | 481 | # This file is released into the public domain.
|
473 |
| -# Generated by versioneer-0.26 |
| 482 | +# Generated by versioneer-0.28 |
474 | 483 | # https://github.com/python-versioneer/python-versioneer
|
475 | 484 |
|
476 | 485 | """Git implementation of _version.py."""
|
@@ -1363,7 +1372,7 @@ def do_vcs_install(versionfile_source, ipy):
|
1363 | 1372 | if "VERSIONEER_PEP518" not in globals():
|
1364 | 1373 | try:
|
1365 | 1374 | my_path = __file__
|
1366 |
| - if my_path.endswith(".pyc") or my_path.endswith(".pyo"): |
| 1375 | + if my_path.endswith((".pyc", ".pyo")): |
1367 | 1376 | my_path = os.path.splitext(my_path)[0] + ".py"
|
1368 | 1377 | versioneer_file = os.path.relpath(my_path)
|
1369 | 1378 | except NameError:
|
@@ -1411,7 +1420,7 @@ def versions_from_parentdir(parentdir_prefix, root, verbose):
|
1411 | 1420 |
|
1412 | 1421 |
|
1413 | 1422 | SHORT_VERSION_PY = """
|
1414 |
| -# This file was generated by 'versioneer.py' (0.26) from |
| 1423 | +# This file was generated by 'versioneer.py' (0.28) from |
1415 | 1424 | # revision-control system data, or from the parent directory name of an
|
1416 | 1425 | # unpacked source archive. Distribution tarballs contain a pre-generated copy
|
1417 | 1426 | # of this file.
|
@@ -1900,6 +1909,8 @@ def run(self):
|
1900 | 1909 | return
|
1901 | 1910 | # now locate _version.py in the new build/ directory and replace
|
1902 | 1911 | # it with an updated value
|
| 1912 | + if not cfg.versionfile_build: |
| 1913 | + return |
1903 | 1914 | target_versionfile = os.path.join(self.build_lib,
|
1904 | 1915 | cfg.versionfile_build)
|
1905 | 1916 | if not os.path.exists(target_versionfile):
|
@@ -1973,7 +1984,7 @@ def run(self):
|
1973 | 1984 |
|
1974 | 1985 | # sdist farms its file list building out to egg_info
|
1975 | 1986 | if 'egg_info' in cmds:
|
1976 |
| - _sdist = cmds['egg_info'] |
| 1987 | + _egg_info = cmds['egg_info'] |
1977 | 1988 | else:
|
1978 | 1989 | from setuptools.command.egg_info import egg_info as _egg_info
|
1979 | 1990 |
|
|
0 commit comments