Skip to content

Commit c978fba

Browse files
authored
Merge pull request #173 from aodn/4328_setuptools_scm
4328 setuptools scm (DO NOT MERGE)
2 parents 4d9655d + 4167252 commit c978fba

8 files changed

Lines changed: 23 additions & 29 deletions

File tree

.bumpversion.cfg

Lines changed: 0 additions & 18 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Ignore the version file, it's created on install
2+
aodntools/_version.py
3+
14
# Python files
25
*.pyc
36
*.egg-info

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ RUN apt-get update && \
1616
RUN add-apt-repository ppa:rael-gc/rvm && apt-get update
1717

1818
RUN apt-get install -y --no-install-recommends \
19-
build-essential \
2019
ca-certificates \
2120
git \
2221
libmagic1 \
2322
libudunits2-dev \
2423
python3-dev \
25-
wget \
26-
libffi-dev \
2724
# Pyenv pre-requisites (from https://github.com/pyenv/pyenv/wiki#suggested-build-environment)
2825
make build-essential libssl-dev zlib1g-dev \
2926
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
@@ -42,12 +39,13 @@ RUN set -ex \
4239
&& pyenv rehash \
4340
&& chmod -R a+w $PYENV_ROOT/shims
4441

45-
RUN pip install --upgrade pip==22.1.2 setuptools==63.1.0 wheel
42+
RUN pip install --upgrade pip==22.1.2 setuptools==63.1.0 wheel build
4643

4744
RUN pip install \
4845
Cython==0.29.30 \
4946
bump2version==1.0.1 \
50-
numpy==1.23.0
47+
numpy==1.23.0 \
48+
setuptools-scm==7.0.4
5149

5250
RUN useradd --create-home --no-log-init --shell /bin/bash --uid $BUILDER_UID builder
5351
USER builder

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pipeline {
3434
}
3535
stage('package') {
3636
steps {
37-
sh 'python setup.py bdist_wheel'
37+
sh 'python -m build -w'
3838
}
3939
}
4040
}

aodntools/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
try:
2+
from ._version import version as __version__
3+
except ImportError:
4+
__version__ = "Unknown/Not Installed"
15
__version__ = '0.0.0'

bumpversion.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ set -euxo pipefail
44

55
main() {
66
git fetch --prune origin "+refs/tags/*:refs/tags/*"
7-
OLD_VERSION=$(git tag -l '*.*.*' --sort=-version:refname | head -n 1)
8-
NEW_VERSION=$(bump2version --current-version $OLD_VERSION --list --tag --commit --allow-dirty patch | grep -oP '^new_version=\K.*$')
9-
git push origin tag $NEW_VERSION
7+
NEW_VERSION=$(bump2version --current-version $(git describe) --list --no-commit --tag \
8+
--tag-message 'Bump version to {new_version}' patch | grep -oP '^new_version=\K.*$')
9+
git push origin tag v$NEW_VERSION
1010

1111
exit 0
1212
}

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[build-system]
2+
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
3+
4+
[tool.setuptools_scm]
5+
write_to = "aodntools/_version.py"

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
]
1010

1111
TESTS_REQUIRE = [
12-
'pytest'
12+
'pytest',
13+
'setuptools_scm',
1314
]
1415

1516
EXTRAS_REQUIRE = {
@@ -26,7 +27,8 @@
2627

2728
setup(
2829
name=PACKAGE_NAME,
29-
version='0.0.0',
30+
use_scm_version=True,
31+
setup_requires=['setuptools_scm'],
3032
packages=find_packages(exclude=PACKAGE_EXCLUDES),
3133
package_data=PACKAGE_DATA,
3234
url='https://github.com/aodn',

0 commit comments

Comments
 (0)