Skip to content

Commit 2081ca3

Browse files
author
Cosimo Lupo
authored
Merge pull request #36 from anthrotype/setuptools_scm
use setuptools_scm to manage package version
2 parents fa33ea2 + 41dbb76 commit 2081ca3

File tree

6 files changed

+19
-18
lines changed

6 files changed

+19
-18
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ Lib/booleanOperations.egg-info
99
.eggs
1010

1111
.DS_Store
12+
13+
.tox/
14+
.cache/

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ python:
77
install:
88
- pip install --upgrade pip setuptools wheel
99
- pip install tox-travis
10+
# Travis by default only clones a 'shallow' repository with --depth=50.
11+
# When building the distribution packages, we use git to determine the
12+
# package version string (via setuptools_scm), hence we need to fetch
13+
# the whole repo, and not just the last 50 commits.
14+
- if [[ $TRAVIS_PYTHON_VERSION == 3.5 ]]; then git fetch --unshallow; fi
1015
script: tox
1116
after_success:
1217
- pip wheel --no-deps -w dist .

Lib/booleanOperations/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from __future__ import print_function, division, absolute_import
22
from .booleanOperationManager import BooleanOperationManager
33

4-
__version__ = "0.5.1"
5-
64
# export BooleanOperationManager static methods
75
union = BooleanOperationManager.union
86
difference = BooleanOperationManager.difference

Lib/booleanOperations/version.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
try:
2+
__version__ = __import__('pkg_resources').require('booleanOperations')[0].version
3+
except Exception:
4+
__version__ = 'unknown'

MANIFEST.in

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
include MANIFEST.in LICENSE README.md
2-
include setup.py requirements.txt setup.cfg tox.ini
3-
recursive-include Lib *.py
4-
recursive-include tests *.py
1+
exclude .travis.yml appveyor.yml .gitignore

setup.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
from setuptools import setup
1+
from setuptools import setup, find_packages
22
import sys
3-
import re
4-
5-
version = ''
6-
with open('Lib/booleanOperations/__init__.py', 'r') as fd:
7-
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
8-
fd.read(), re.MULTILINE).group(1)
9-
if not version:
10-
raise RuntimeError('Cannot find version information')
113

124
needs_pytest = {'pytest', 'test'}.intersection(sys.argv)
135
pytest_runner = ['pytest_runner'] if needs_pytest else []
@@ -19,16 +11,18 @@
1911

2012
setup_params = dict(
2113
name="booleanOperations",
22-
version=version,
14+
use_scm_version=True,
2315
description="Boolean operations on paths.",
2416
long_description=long_description,
2517
author="Frederik Berlaen",
2618
author_email="[email protected]",
2719
url="https://github.com/typemytype/booleanOperations",
2820
license="MIT",
29-
packages=["booleanOperations"],
3021
package_dir={"": "Lib"},
31-
setup_requires=pytest_runner + wheel,
22+
packages=find_packages("Lib"),
23+
setup_requires=[
24+
"setuptools_scm>=1.11.1",
25+
] + pytest_runner + wheel,
3226
tests_require=[
3327
'pytest>=3.0.2',
3428
],

0 commit comments

Comments
 (0)