Skip to content

Commit 7242b65

Browse files
committed
#465 Use setuptools-scm to get version with a git tag
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent b18c4f6 commit 7242b65

8 files changed

Lines changed: 52 additions & 3 deletions

File tree

etc/conf/base.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ wheel
55
pip
66
wincertstore
77
six
8+
setuptools-scm
89

910
# Self
1011
-e .

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ license_file = NOTICE
33

44
[aliases]
55
pypi_release = clean --all sdist --formats=bztar bdist_wheel register upload
6+
release = clean --all sdist --formats=bztar bdist_wheel
67

78
[tool:pytest]
89
testpaths =

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def read(*names, **kwargs):
3131
setup(
3232
name='scancode-toolkit',
3333
version='2.0.0rc3',
34+
use_scm_version=True,
35+
setup_requires=['setuptools_scm'],
3436
license='Apache-2.0 with ScanCode acknowledgment and CC0-1.0 and others',
3537
description='ScanCode is a tool to scan code for license, copyright and other interesting facts.',
3638
long_description=long_description,

src/scancode/__init__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
# ScanCode is a free software code scanning tool from nexB Inc. and others.
2323
# Visit https://github.com/nexB/scancode-toolkit/ for support and download.
2424

25-
__version__ = '2.0.0rc3'
25+
from __future__ import print_function
26+
from __future__ import absolute_import
2627

2728
from os.path import dirname
2829
from os.path import abspath
@@ -33,6 +34,7 @@
3334

3435
from commoncode import fileutils
3536

37+
3638
scan_src_dir = abspath(dirname(__file__))
3739
src_dir = dirname(scan_src_dir)
3840
root_dir = dirname(src_dir)
@@ -41,3 +43,13 @@
4143

4244
if not exists(scans_cache_dir):
4345
fileutils.create_dir(scans_cache_dir)
46+
47+
48+
__version__ = '2.0.0rc3'
49+
50+
try:
51+
from setuptools_scm import get_version
52+
__version__ = get_version(root=root_dir, relative_to=__file__)
53+
except:
54+
pass
55+

thirdparty/base/setuptools.ABOUT

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ download_url: https://pypi.python.org/packages/69/19/b1dff551058ce79d88b1e3688f1
77
home_url: https://pypi.python.org/pypi/setuptools
88
owner: Python Packaging Authority
99

10-
dje_license: psf
11-
license_text_file: PSF.LICENSE
10+
dje_license: psf and mit
11+
license_text_file:
12+
- PSF.LICENSE
13+
- setuptools.LICENSE
17.4 KB
Binary file not shown.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
about_resource: setuptools_scm-1.15.0-py2.py3-none-any.whl
2+
name: setuptools-scm
3+
version: 1.15.0
4+
5+
download_url: https://pypi.python.org/packages/f7/8b/96bf8303d35080ea7469d531955f0911f1be7f3ddc34ec05e98af1022e65/setuptools_scm-1.15.0-py2.py3-none-any.whl#md5=1d961668aefcbb8f016ee950be1cfc95
6+
7+
home_url: https://github.com/pypa/setuptools_scm/
8+
owner: Python Packaging Authority
9+
10+
copyright: copyright (c) 2010-2015 by Ronny Pfannschmidt and the Python Packaging Authority
11+
dje_license: mit
12+
license_text_file: PSF.LICENSE
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
copyright (c) 2010-2015 by Ronny Pfannschmidt and the Python Packaging Authority
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

0 commit comments

Comments
 (0)