File tree Expand file tree Collapse file tree 4 files changed +31
-12
lines changed Expand file tree Collapse file tree 4 files changed +31
-12
lines changed Original file line number Diff line number Diff line change 17
17
uses : actions/setup-python@v3
18
18
with :
19
19
python-version : 3.x
20
- - name : Replace the hard-coded version number
21
- run : sed -i "s/LAST_TAG/${GITHUB_REF#refs/tags/}/g" alibuild_helpers/__init__.py
22
20
- name : Build the Python distribution
23
21
run : python setup.py sdist
24
22
- name : Publish distribution to PyPI
Original file line number Diff line number Diff line change 11
11
# For unit tests
12
12
build.log
13
13
.tox
14
+ # For setuptools_scm
15
+ alibuild_helpers /_version.py
Original file line number Diff line number Diff line change 1
1
# This file is needed to package build_template.sh.
2
2
3
- # Versions should comply with PEP440. For a discussion on single-sourcing the
4
- # version across setup.py and the project code, see
5
- # https://packaging.python.org/en/latest/single_source_version.html
6
- #
7
- # LAST_TAG is actually a placeholder which will be automatically replaced by
8
- # the release-alibuild pipeline in jenkins whenever we need a new release.
9
- __version__ = 'LAST_TAG'
3
+ # Single-source a PEP440-compliant version using setuptools_scm.
4
+ try :
5
+ # This is an sdist or wheel, and it's properly installed.
6
+ from alibuild_helpers ._version import __version__
7
+ except ImportError :
8
+ # We're probably running directly from a source checkout.
9
+ try :
10
+ from setuptools_scm import get_version
11
+ except ImportError :
12
+ __version__ = '(could not detect version)'
13
+ else :
14
+ try :
15
+ __version__ = get_version ()
16
+ except LookupError :
17
+ __version__ = '(could not detect version)'
18
+ finally :
19
+ del get_version
Original file line number Diff line number Diff line change 8
8
from codecs import open
9
9
import os .path
10
10
import sys
11
- import alibuild_helpers
12
11
13
12
here = os .path .abspath (os .path .dirname (__file__ ))
14
13
25
24
setup (
26
25
name = 'alibuild' ,
27
26
28
- version = alibuild_helpers .__version__ ,
29
-
30
27
description = 'ALICE Build Tool' ,
31
28
long_description = long_description ,
32
29
75
72
# this:
76
73
# py_modules=["my_module"],
77
74
75
+ # Single-source our package version using setuptools_scm. This makes it
76
+ # PEP440-compliant, and it always references the alibuild commit that
77
+ # aliBuild was built from.
78
+ use_scm_version = {'write_to' : 'alibuild_helpers/_version.py' },
79
+ setup_requires = [
80
+ # The 6.* series removed support for Python 2.7.
81
+ 'setuptools_scm<6.0.0' if sys .version_info < (3 , 0 ) else
82
+ # The 7.* series removed support for Python 3.6.
83
+ 'setuptools_scm<7.0.0' if sys .version_info < (3 , 7 ) else
84
+ 'setuptools_scm'
85
+ ],
86
+
78
87
# List run-time dependencies here. These will be installed by pip when
79
88
# your project is installed. For an analysis of "install_requires" vs pip's
80
89
# requirements files see:
You can’t perform that action at this time.
0 commit comments