diff --git a/debian/clean b/debian/clean new file mode 100644 index 0000000000000000000000000000000000000000..9c39133d9524406dc4819007b60256fe044e853e --- /dev/null +++ b/debian/clean @@ -0,0 +1 @@ +pyvo/version.py diff --git a/debian/patches/00-create-auto-generated-version-file.patch b/debian/patches/00-create-auto-generated-version-file.patch deleted file mode 100644 index a829372e454d209f0b47976deb7f6e49c5e0267e..0000000000000000000000000000000000000000 --- a/debian/patches/00-create-auto-generated-version-file.patch +++ /dev/null @@ -1,233 +0,0 @@ -Description: Add auto generated at build time file used by upstream to check if current - session is handled by the right pyvo version. -Author: Josue Ortega -Last-Update: 2019-01-20 - ---- /dev/null -+++ pyvo-0.9.2/pyvo/version.py -@@ -0,0 +1,225 @@ -+# Autogenerated by Astropy-affiliated package pyvo's setup.py on 2019-01-18 02:47:21 UTC -+from __future__ import unicode_literals -+import datetime -+ -+ -+import locale -+import os -+import subprocess -+import warnings -+ -+ -+def _decode_stdio(stream): -+ try: -+ stdio_encoding = locale.getdefaultlocale()[1] or 'utf-8' -+ except ValueError: -+ stdio_encoding = 'utf-8' -+ -+ try: -+ text = stream.decode(stdio_encoding) -+ except UnicodeDecodeError: -+ # Final fallback -+ text = stream.decode('latin1') -+ -+ return text -+ -+ -+def update_git_devstr(version, path=None): -+ """ -+ Updates the git revision string if and only if the path is being imported -+ directly from a git working copy. This ensures that the revision number in -+ the version string is accurate. -+ """ -+ -+ try: -+ # Quick way to determine if we're in git or not - returns '' if not -+ devstr = get_git_devstr(sha=True, show_warning=False, path=path) -+ except OSError: -+ return version -+ -+ if not devstr: -+ # Probably not in git so just pass silently -+ return version -+ -+ if 'dev' in version: # update to the current git revision -+ version_base = version.split('.dev', 1)[0] -+ devstr = get_git_devstr(sha=False, show_warning=False, path=path) -+ -+ return version_base + '.dev' + devstr -+ else: -+ # otherwise it's already the true/release version -+ return version -+ -+ -+def get_git_devstr(sha=False, show_warning=True, path=None): -+ """ -+ Determines the number of revisions in this repository. -+ -+ Parameters -+ ---------- -+ sha : bool -+ If True, the full SHA1 hash will be returned. Otherwise, the total -+ count of commits in the repository will be used as a "revision -+ number". -+ -+ show_warning : bool -+ If True, issue a warning if git returns an error code, otherwise errors -+ pass silently. -+ -+ path : str or None -+ If a string, specifies the directory to look in to find the git -+ repository. If `None`, the current working directory is used, and must -+ be the root of the git repository. -+ If given a filename it uses the directory containing that file. -+ -+ Returns -+ ------- -+ devversion : str -+ Either a string with the revision number (if `sha` is False), the -+ SHA1 hash of the current commit (if `sha` is True), or an empty string -+ if git version info could not be identified. -+ -+ """ -+ -+ if path is None: -+ path = os.getcwd() -+ -+ if not os.path.isdir(path): -+ path = os.path.abspath(os.path.dirname(path)) -+ -+ if sha: -+ # Faster for getting just the hash of HEAD -+ cmd = ['rev-parse', 'HEAD'] -+ else: -+ cmd = ['rev-list', '--count', 'HEAD'] -+ -+ def run_git(cmd): -+ try: -+ p = subprocess.Popen(['git'] + cmd, cwd=path, -+ stdout=subprocess.PIPE, -+ stderr=subprocess.PIPE, -+ stdin=subprocess.PIPE) -+ stdout, stderr = p.communicate() -+ except OSError as e: -+ if show_warning: -+ warnings.warn('Error running git: ' + str(e)) -+ return (None, b'', b'') -+ -+ if p.returncode == 128: -+ if show_warning: -+ warnings.warn('No git repository present at {0!r}! Using ' -+ 'default dev version.'.format(path)) -+ return (p.returncode, b'', b'') -+ if p.returncode == 129: -+ if show_warning: -+ warnings.warn('Your git looks old (does it support {0}?); ' -+ 'consider upgrading to v1.7.2 or ' -+ 'later.'.format(cmd[0])) -+ return (p.returncode, stdout, stderr) -+ elif p.returncode != 0: -+ if show_warning: -+ warnings.warn('Git failed while determining revision ' -+ 'count: {0}'.format(_decode_stdio(stderr))) -+ return (p.returncode, stdout, stderr) -+ -+ return p.returncode, stdout, stderr -+ -+ returncode, stdout, stderr = run_git(cmd) -+ -+ if not sha and returncode == 128: -+ # git returns 128 if the command is not run from within a git -+ # repository tree. In this case, a warning is produced above but we -+ # return the default dev version of '0'. -+ return '0' -+ elif not sha and returncode == 129: -+ # git returns 129 if a command option failed to parse; in -+ # particular this could happen in git versions older than 1.7.2 -+ # where the --count option is not supported -+ # Also use --abbrev-commit and --abbrev=0 to display the minimum -+ # number of characters needed per-commit (rather than the full hash) -+ cmd = ['rev-list', '--abbrev-commit', '--abbrev=0', 'HEAD'] -+ returncode, stdout, stderr = run_git(cmd) -+ # Fall back on the old method of getting all revisions and counting -+ # the lines -+ if returncode == 0: -+ return str(stdout.count(b'\n')) -+ else: -+ return '' -+ elif sha: -+ return _decode_stdio(stdout)[:40] -+ else: -+ return _decode_stdio(stdout).strip() -+ -+ -+# This function is tested but it is only ever executed within a subprocess when -+# creating a fake package, so it doesn't get picked up by coverage metrics. -+def _get_repo_path(pathname, levels=None): # pragma: no cover -+ """ -+ Given a file or directory name, determine the root of the git repository -+ this path is under. If given, this won't look any higher than ``levels`` -+ (that is, if ``levels=0`` then the given path must be the root of the git -+ repository and is returned if so. -+ -+ Returns `None` if the given path could not be determined to belong to a git -+ repo. -+ """ -+ -+ if os.path.isfile(pathname): -+ current_dir = os.path.abspath(os.path.dirname(pathname)) -+ elif os.path.isdir(pathname): -+ current_dir = os.path.abspath(pathname) -+ else: -+ return None -+ -+ current_level = 0 -+ -+ while levels is None or current_level <= levels: -+ if os.path.exists(os.path.join(current_dir, '.git')): -+ return current_dir -+ -+ current_level += 1 -+ if current_dir == os.path.dirname(current_dir): -+ break -+ -+ current_dir = os.path.dirname(current_dir) -+ -+ return None -+ -+ -+_packagename = "pyvo" -+_last_generated_version = "0.9.2" -+_last_githash = "None" -+ -+# Determine where the source code for this module -+# lives. If __file__ is not a filesystem path then -+# it is assumed not to live in a git repo at all. -+if _get_repo_path(__file__, levels=len(_packagename.split('.'))): -+ version = update_git_devstr(_last_generated_version, path=__file__) -+ githash = get_git_devstr(sha=True, show_warning=False, -+ path=__file__) or _last_githash -+else: -+ # The file does not appear to live in a git repo so don't bother -+ # invoking git -+ version = _last_generated_version -+ githash = _last_githash -+ -+ -+major = 0 -+minor = 9 -+bugfix = 2 -+ -+release = True -+timestamp = datetime.datetime(2019, 1, 18, 2, 47, 21) -+debug = False -+ -+astropy_helpers_version = "3.0.2" -+ -+try: -+ from ._compiler import compiler -+except ImportError: -+ compiler = "unknown" -+ -+try: -+ from .cython_version import cython_version -+except ImportError: -+ cython_version = "unknown" diff --git a/debian/patches/removes-version-generator.patch b/debian/patches/removes-version-generator.patch deleted file mode 100644 index 3906317dfb9533b9057c67b8be326574e2c14d7b..0000000000000000000000000000000000000000 --- a/debian/patches/removes-version-generator.patch +++ /dev/null @@ -1,26 +0,0 @@ -Description: Removes auto generation of version.py by astropy helpers -Author: Josue Ortega -Last-Update: 2016-08-13 - ---- a/setup.py -+++ b/setup.py -@@ -18,7 +18,7 @@ - from astropy_helpers.setup_helpers import (register_commands, get_debug_option, - get_package_info) - from astropy_helpers.git_helpers import get_git_devstr --from astropy_helpers.version_helpers import generate_version_py -+#from astropy_helpers.version_helpers import generate_version_py - - # Get some values from the setup.cfg - try: -@@ -80,8 +80,8 @@ - cmdclassd = register_commands(PACKAGENAME, VERSION, RELEASE) - - # Freeze build information in version.py --generate_version_py(PACKAGENAME, VERSION, RELEASE, -- get_debug_option(PACKAGENAME)) -+#generate_version_py(PACKAGENAME, VERSION, RELEASE, -+# get_debug_option(PACKAGENAME)) - - # Treat everything in scripts except README* as a script to be installed - scripts = [fname for fname in glob.glob(os.path.join('scripts', '*')) diff --git a/debian/patches/series b/debian/patches/series index 092c5a31782ee12b0bb186b344438684dd495bb3..dfaac020231dfe85509f43be7f8e6218d619773c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,4 +1,2 @@ -00-create-auto-generated-version-file.patch removes-python-scripts.patch use_system_astropy_helpers.patch -removes-version-generator.patch