From 8360f2db5fb7075ae0b4abc004717873b416c82d Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Tue, 17 Dec 2019 12:57:36 -0500 Subject: [PATCH 1/3] Added changes to use setuptools_scm --- setup.py | 4 +-- starcheck/__init__.py | 5 +++- starcheck/version.py | 60 ------------------------------------------- 3 files changed, 6 insertions(+), 63 deletions(-) delete mode 100644 starcheck/version.py diff --git a/setup.py b/setup.py index 0c155ed3..81aaf7e7 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,10 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst from setuptools import setup -from starcheck.version import version setup(name='starcheck', - version=version, + use_scm_version=True, + setup_requires=['setuptools_scm', 'setuptools_scm_git_archive'], author='Jean Connelly', author_email='jconnelly@cfa.harvard.edu', packages=['starcheck'], diff --git a/starcheck/__init__.py b/starcheck/__init__.py index b440b572..a5bd990f 100644 --- a/starcheck/__init__.py +++ b/starcheck/__init__.py @@ -1,2 +1,5 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -from .version import __version__ + +import ska_helpers + +__version__ = ska_helpers.get_version(__package__) diff --git a/starcheck/version.py b/starcheck/version.py deleted file mode 100644 index a6926b12..00000000 --- a/starcheck/version.py +++ /dev/null @@ -1,60 +0,0 @@ -# Licensed under a 3-clause BSD style license - see LICENSE.rst -""" -Version numbering. The `major`, `minor`, and `bugfix` -variables hold the respective parts of the version number (bugfix is '0' if -absent). The `release` variable is True if this is a release, and False if this -is a development version. For the actual version string, use:: - - from starcheck import version - -or:: - - from starcheck import __version__ - -NOTE: this code copied from astropy and modified. Any license restrictions -therein are applicable. -""" - -version = '13.5' - -_versplit = version.replace('dev', '').split('.') -major = int(_versplit[0]) -minor = int(_versplit[1]) -if len(_versplit) < 3: - bugfix = 0 -else: - bugfix = int(_versplit[2]) -del _versplit - -release = not version.endswith('dev') - - -def _get_git_devstr(): - """Determines the number of revisions in this repository and returns "" if - this is not possible. - - Returns - ------- - devstr : str - A string that begins with 'dev' to be appended to the version number - string. - """ - from os import path - from subprocess import Popen, PIPE - - currdir = path.abspath(path.split(__file__)[0]) - - p = Popen(['git', 'rev-list', 'HEAD'], cwd=currdir, - stdout=PIPE, stderr=PIPE, stdin=PIPE) - stdout, stderr = p.communicate() - - if p.returncode != 0: - return '' - else: - revs = stdout.decode('ascii').split('\n') - return '-r%s-%s' % (len(revs), revs[0][:7]) - -if not release: - version = version + _get_git_devstr() - -__version__ = version From ffa70ce229ea9e91dcec9be43064838a63a3de26 Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Tue, 17 Dec 2019 15:35:19 -0500 Subject: [PATCH 2/3] found and removed uses of version.py --- starcheck/calc_ccd_temps.py | 2 +- starcheck/src/starcheck.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/starcheck/calc_ccd_temps.py b/starcheck/calc_ccd_temps.py index f041112b..2fbd1628 100755 --- a/starcheck/calc_ccd_temps.py +++ b/starcheck/calc_ccd_temps.py @@ -40,7 +40,7 @@ from parse_cm import read_or_list from chandra_aca.drift import get_aca_offsets -from starcheck.version import version +from starcheck import __version__ as version MSID = {'aca': 'AACCCDPT'} TASK_DATA = os.path.dirname(__file__) diff --git a/starcheck/src/starcheck.pl b/starcheck/src/starcheck.pl index 3051cbf5..d96323c8 100755 --- a/starcheck/src/starcheck.pl +++ b/starcheck/src/starcheck.pl @@ -55,7 +55,7 @@ import starcheck from starcheck.pcad_att_check import make_pcad_attitude_check_report, check_characteristics_date from starcheck.calc_ccd_temps import get_ccd_temps -from starcheck.version import version +from starcheck import __version__ as version from kadi.commands import states # Borrowed from https://stackoverflow.com/a/33160507 From 9992beca390070f7e7d9fc38f86fd8caf228ee5d Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Fri, 20 Dec 2019 11:42:18 -0500 Subject: [PATCH 3/3] added files for scm git archive --- .git_archival.txt | 1 + .gitattributes | 1 + 2 files changed, 2 insertions(+) create mode 100644 .git_archival.txt create mode 100644 .gitattributes diff --git a/.git_archival.txt b/.git_archival.txt new file mode 100644 index 00000000..95cb3eea --- /dev/null +++ b/.git_archival.txt @@ -0,0 +1 @@ +ref-names: $Format:%D$ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..00a7b00c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.git_archival.txt export-subst