Hello community, here is the log from the commit of package python-param for openSUSE:Factory checked in at 2018-05-16 11:39:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-param (Old) and /work/SRC/openSUSE:Factory/.python-param.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-param" Wed May 16 11:39:33 2018 rev:4 rq:606681 version:1.6.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-param/python-param.changes 2018-04-19 15:31:24.946311598 +0200 +++ /work/SRC/openSUSE:Factory/.python-param.new/python-param.changes 2018-05-16 11:41:05.205405501 +0200 @@ -1,0 +2,14 @@ +Fri May 11 23:11:13 UTC 2018 - [email protected] + +- update to version 1.6.1: + * Restores support for the previous versioning system (pre 1.6; see + #225), and fixes a number of issues with the new versioning + system: + + Allow package name to differ from repository name + (pyviz/autover#39) + + Allow develop install to work when repository is dirty + (pyviz/autover#41) + + Fixed failure to report dirty when commit count is 0 + (pyviz/autover#44) + +------------------------------------------------------------------- Old: ---- param-1.6.0.tar.gz New: ---- param-1.6.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-param.spec ++++++ --- /var/tmp/diff_new_pack.rRlvMW/_old 2018-05-16 11:41:07.257330829 +0200 +++ /var/tmp/diff_new_pack.rRlvMW/_new 2018-05-16 11:41:07.261330684 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-param # -# Copyright (c) 2018 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,17 +18,17 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-param -Version: 1.6.0 +Version: 1.6.1 Release: 0 Summary: Declarative Python programming using Parameters License: BSD-3-Clause Group: Development/Languages/Python -Url: http://ioam.github.com/param/ +URL: http://ioam.github.com/param/ Source: https://files.pythonhosted.org/packages/source/p/param/param-%{version}.tar.gz -BuildRequires: fdupes -BuildRequires: python-rpm-macros BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros Recommends: python-numpy BuildArch: noarch %python_subpackages @@ -55,8 +55,8 @@ %python_expand %fdupes %{buildroot}%{$python_sitelib} %files %{python_files} -%defattr(-,root,root,-) -%doc LICENSE.txt README.rst +%license LICENSE.txt +%doc README.rst %{python_sitelib}/param/ %{python_sitelib}/numbergen/ %{python_sitelib}/param-%{version}-py*.egg-info ++++++ param-1.6.0.tar.gz -> param-1.6.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/param-1.6.0/PKG-INFO new/param-1.6.1/PKG-INFO --- old/param-1.6.0/PKG-INFO 2018-04-05 12:25:08.000000000 +0200 +++ new/param-1.6.1/PKG-INFO 2018-04-25 17:55:48.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: param -Version: 1.6.0 +Version: 1.6.1 Summary: Declarative Python programming using Parameters. Home-page: http://ioam.github.com/param/ Author: IOAM diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/param-1.6.0/param/.version new/param-1.6.1/param/.version --- old/param-1.6.0/param/.version 2018-04-05 12:25:07.000000000 +0200 +++ new/param-1.6.1/param/.version 2018-04-25 17:55:48.000000000 +0200 @@ -1 +1 @@ -{"git_describe": "v1.6.0-0-g445d051", "version_string": "1.6.0"} \ No newline at end of file +{"git_describe": "v1.6.1-0-g9b8efe5", "version_string": "1.6.1"} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/param-1.6.0/param/version.py new/param-1.6.1/param/version.py --- old/param-1.6.0/param/version.py 2018-04-05 12:24:35.000000000 +0200 +++ new/param-1.6.1/param/version.py 2018-04-25 17:54:52.000000000 +0200 @@ -1,122 +1,20 @@ -"""Apart from this first paragraph, this version.py file is an exact -copy of https://github.com/ioam/autover/blob/59c207db70da6f41b689e8be5c5f6abb1e062c8e/autover/version.py. -Autover's version.py is included inside the param package only to make -version.py available to various other projects that use version.py and -already depend on param, thus saving them from bundling version.py or -dependending on autover. Otherwise, version.py would only be in the -root of param's git repository, and would not be part of the param -package. - ------ - -Provide consistent and up-to-date ``__version__`` strings for Python -packages. - -It is easy to forget to update ``__version__`` strings when releasing -a project, and it is important that the ``__version__`` strings are -useful over the course of development even between releases, -especially if releases are infrequent. - -This file provides a Version class that addresses both problems. -Version is meant to be a simple, bare-bones approach that focuses on (a) -ensuring that all declared version information matches for a release if -supplied, and (b) providing fine-grained version information via a -version control system (VCS) in between releases (c) allowing versions -to be specified with tags alone. Other approaches like versioneer.py -can automate more of the process of making releases, but they require -more complex self-modifying code and code generation techniques than the -simple Python class declaration used here. - -Currently, the only VCS supported is git, but others could be added -easily. - -To use Version in a project that provides a Python package named -``package`` maintained in a git repository named ``packagegit``: - -1. Make the Version class available for import from your package, - either by adding the PyPI package "autover" as a dependency for your - package, or by simply copying this file into ``package/autover.py``. - -2. Assuming that the current version of your package is 1.0.0 (and you - want to enforce this), add the following lines to your - ``package/__init__.py``:: - - from autover import Version - __version__ = Version(release=(1,0,0), fpath=__file__, - commit="$Format:%h$", reponame="packagegit") - - (or ``from .version import Version`` if you copied the file directly.) - - You can supply release=None if you want to set the version purely via a tag. - -3. Declare the version as a string in your package's setup.py file, e.g.:: - - setup_args["version"]="1.0.0" - - This acts as an explicit check you can verify against. You can also set this - up against the tag using: - - setup_args["version"]=get_setup_version("autover") # Your package name here - - To use this, adapt the get_setup_version function in autover/setup.py for use - in your package's setup.py. - - -4. (Optional) In your package's setup.py script code for making a - release, you can add a call to the Version.verify method. E.g.:: - - setup_args = dict(name='package', version="1.0.0", ...) - - if __name__=="__main__": - if 'upload' in sys.argv: - import package - package.__version__.verify(setup_args['version']) - setup(**setup_args) - - This can help make sure the repository is in a good state before - building a package (e.g not dirty). - -4. Tag the version of the repository to be released with a string of - the form v*.*.*, i.e. ``v1.0.0`` in this example. E.g. for git:: - - git tag -a v1.0.0 -m 'Release version 1.0.0' ; git push - - You need to use an annotated tag (i.e the -a flag) and you can use - PEP440 compliant strings as long as they start with a 'v' e.g - v1.0.1a1 v2.3rc5 etc. - -If you chose to specify explicit version strings in setup.py and -__init__.py and used the verify method, running ``setup.py`` to make a -release via something like ``python setup.py register sdist upload``, -Python will verify that the version last tagged in the VCS is the same -as what is declared in the package and the setup.py, aborting the -release until either the tag is corrected or the declared version is -made to match the tag. - -Releases installed without VCS information will then report the declared -release version if specified, otherwise it will read the .version file -containing the VSC information when the package was build . If live VCS -information is available and matches the specified repository name, then -the version reported from e.g. ``str(package.__version__)`` will provide -more detailed information about the precise VCS revision changes since -the release. See the docstring for the Version class for more detailed -information. - -If you used release=None in __init__.py and the get_setup_version -function in setup.py, all you need to get a live version string is set -an appropriate VCS tag. Note that to ensure this is always correct, -autover is required as a build dependency, otherwise the information -available in the .version file is used. - -This file is in the public domain, provided as-is, with no warranty of -any kind expressed or implied. Anyone is free to copy, modify, -publish, use, compile, sell, or distribute it under any license, for -any purpose, commercial or non-commercial, and by any means. The -original file is maintained at: -https://github.com/ioam/autover/blob/master/autover/__init__.py +""" +Provide consistent and up-to-date ``__version__`` strings for +Python packages. +See https://github.com/pyviz/autover for more information. """ +# The Version class is a copy of autover.version.Version v0.2.5, +# except as noted below. +# +# The current version of autover supports a workflow based on tagging +# a git repository, and reports PEP440 compliant version information. +# Previously, the workflow required editing of version numbers in +# source code, and the version was not necessarily PEP440 compliant. +# Version.__new__ is added here to provide the previous Version class +# (OldDeprecatedVersion) if Version is called in the old way. + __author__ = 'Jean-Luc Stevens' @@ -178,6 +76,17 @@ alternate valid prefix such as '.rev', '_rev', '_r' or '.r' may be supplied.""" + def __new__(cls,**kw): + # If called in the old way, provide the previous class. Means + # PEP440/tag based workflow warning below will never appear. + if ('release' in kw and kw['release'] is not None) or \ + ('dev' in kw and kw['dev'] is not None) or \ + ('commit_count' in kw): + return OldDeprecatedVersion(**kw) + else: + return super(Version, cls).__new__(cls) + + def __init__(self, release=None, fpath=None, commit=None, reponame=None, commit_count_prefix='.post', archive_commit=None, **kwargs): """ @@ -379,7 +288,7 @@ release = '.'.join(str(el) for el in self.release) prerelease = '' if self.prerelease is None else self.prerelease - if self.commit_count == 0: + if self.commit_count == 0 and not self.dirty: return release + prerelease commit = self.commit @@ -438,13 +347,14 @@ @classmethod def get_setup_version(cls, setup_path, reponame, describe=False, - dirty='raise', archive_commit=None): + dirty='report', pkgname=None, archive_commit=None): """ Helper for use in setup.py to get the version from the .version file (if available) or more up-to-date information from git describe (if available). Assumes the __init__.py will be found in the directory - {reponame}/__init__.py relative to setup.py. + {reponame}/__init__.py relative to setup.py unless pkgname is + explicitly specified in which case that name is used instead. If describe is True, the raw string obtained from git described is returned which is useful for updating the .version file. @@ -457,11 +367,12 @@ be useful if you want to make sure packages are not built from a dirty repository state. """ + pkgname = reponame if pkgname is None else pkgname policies = ['raise','report', 'strip'] if dirty not in policies: raise AssertionError("get_setup_version dirty policy must be in %r" % policies) - fpath = os.path.join(setup_path, reponame, "__init__.py") + fpath = os.path.join(setup_path, pkgname, "__init__.py") version = Version(fpath=fpath, reponame=reponame, archive_commit=archive_commit) if describe: vstring = version.git_fetch(as_string=True) @@ -489,15 +400,18 @@ @classmethod - def setup_version(cls, setup_path, reponame, archive_commit=None, dirty='raise'): + def setup_version(cls, setup_path, reponame, archive_commit=None, + pkgname=None, dirty='report'): info = {} git_describe = None + pkgname = reponame if pkgname is None else pkgname try: # Will only work if in a git repo and git is available git_describe = Version.get_setup_version(setup_path, reponame, describe=True, dirty=dirty, + pkgname=pkgname, archive_commit=archive_commit) if git_describe is not None: @@ -509,7 +423,7 @@ if extracted_directory_tag is not None: info['extracted_directory_tag'] = extracted_directory_tag try: - with open(os.path.join(setup_path, reponame, '.version'), 'w') as f: + with open(os.path.join(setup_path, pkgname, '.version'), 'w') as f: f.write(json.dumps({'extracted_directory_tag':extracted_directory_tag})) except: print('Error in setup_version: could not write .version file.') @@ -519,11 +433,250 @@ reponame, describe=False, dirty=dirty, + pkgname=pkgname, archive_commit=archive_commit) try: - with open(os.path.join(setup_path, reponame, '.version'), 'w') as f: + with open(os.path.join(setup_path, pkgname, '.version'), 'w') as f: f.write(json.dumps(info)) except: print('Error in setup_version: could not write .version file.') return info['version_string'] + + + +# from param/version.py aa087db29976d9b7e0f59c29789dfd721c85afd0 +class OldDeprecatedVersion(object): + """ + A simple approach to Python package versioning that supports PyPI + releases and additional information when working with version + control. When obtaining a package from PyPI, the version returned + is a string-formatted rendering of the supplied release tuple. + For instance, release (1,0) tagged as ``v1.0`` in the version + control system will return ``1.0`` for ``str(__version__)``. Any + number of items can be supplied in the release tuple, with either + two or three numeric versioning levels typical. + + During development, a command like ``git describe`` will be used to + compute the number of commits since the last version tag, the + short commit hash, and whether the commit is dirty (has changes + not yet committed). Version tags must start with a lowercase 'v' + and have a period in them, e.g. v2.0, v0.9.8 or v0.1. + + Development versions are supported by setting the dev argument to an + appropriate dev version number. The corresponding tag can be PEP440 + compliant (using .devX) of the form v0.1.dev3, v1.9.0.dev2 etc but + it doesn't have to be as the dot may be omitted i.e v0.1dev3, + v1.9.0dev2 etc. + + Also note that when version control system (VCS) information is + used, the comparison operators take into account the number of + commits since the last version tag. This approach is often useful + in practice to decide which version is newer for a single + developer, but will not necessarily be reliable when comparing + against a different fork or branch in a distributed VCS. + + For git, if you want version control information available even in + an exported archive (e.g. a .zip file from GitHub), you can set + the following line in the .gitattributes file of your project:: + + __init__.py export-subst + """ + + def __init__(self, release=None, fpath=None, commit=None, + reponame=None, dev=None, commit_count=0): + """ + :release: Release tuple (corresponding to the current VCS tag) + :commit Short SHA. Set to '$Format:%h$' for git archive support. + :fpath: Set to ``__file__`` to access version control information + :reponame: Used to verify VCS repository name. + :dev: Development version number. None if not a development version. + :commit_count Commits since last release. Set for dev releases. + """ + self.fpath = fpath + self._expected_commit = commit + self.expected_release = release + + self._commit = None if commit in [None, "$Format:%h$"] else commit + self._commit_count = commit_count + self._release = None + self._dirty = False + self.reponame = reponame + self.dev = dev + + @property + def release(self): + "Return the release tuple" + return self.fetch()._release + + @property + def commit(self): + "A specification for this particular VCS version, e.g. a short git SHA" + return self.fetch()._commit + + @property + def commit_count(self): + "Return the number of commits since the last release" + return self.fetch()._commit_count + + @property + def dirty(self): + "True if there are uncommited changes, False otherwise" + return self.fetch()._dirty + + + def fetch(self): + """ + Returns a tuple of the major version together with the + appropriate SHA and dirty bit (for development version only). + """ + if self._release is not None: + return self + + self._release = self.expected_release + if not self.fpath: + self._commit = self._expected_commit + return self + + # Only git right now but easily extended to SVN, Mercurial, etc. + for cmd in ['git', 'git.cmd', 'git.exe']: + try: + self.git_fetch(cmd) + break + except EnvironmentError: + pass + return self + + + def git_fetch(self, cmd='git'): + try: + if self.reponame is not None: + # Verify this is the correct repository (since fpath could + # be an unrelated git repository, and param could just have + # been copied/installed into it). + output = run_cmd([cmd, 'remote', '-v'], + cwd=os.path.dirname(self.fpath)) + repo_matches = ['/' + self.reponame + '.git' , + # A remote 'server:reponame.git' can also be referred + # to (i.e. cloned) as `server:reponame`. + '/' + self.reponame + ' '] + if not any(m in output for m in repo_matches): + return self + + output = run_cmd([cmd, 'describe', '--long', '--match', 'v*.*', '--dirty'], + cwd=os.path.dirname(self.fpath)) + except Exception as e: + if e.args[1] == 'fatal: No names found, cannot describe anything.': + raise Exception("Cannot find any git version tags of format v*.*") + # If there is any other error, return (release value still useful) + return self + + self._update_from_vcs(output) + + def _update_from_vcs(self, output): + "Update state based on the VCS state e.g the output of git describe" + split = output[1:].split('-') + if 'dev' in split[0]: + dev_split = split[0].split('dev') + self.dev = int(dev_split[1]) + split[0] = dev_split[0] + # Remove the pep440 dot if present + if split[0].endswith('.'): + split[0] = dev_split[0][:-1] + + self._release = tuple(int(el) for el in split[0].split('.')) + self._commit_count = int(split[1]) + self._commit = str(split[2][1:]) # Strip out 'g' prefix ('g'=>'git') + self._dirty = (split[-1]=='dirty') + return self + + + def __str__(self): + """ + Version in x.y.z string format. Does not include the "v" + prefix of the VCS version tags, for pip compatibility. + + If the commit count is non-zero or the repository is dirty, + the string representation is equivalent to the output of:: + + git describe --long --match v*.* --dirty + + (with "v" prefix removed). + """ + if self.release is None: return 'None' + release = '.'.join(str(el) for el in self.release) + release = '%s.dev%d' % (release, self.dev) if self.dev is not None else release + + if (self._expected_commit is not None) and ("$Format" not in self._expected_commit): + pass # Concrete commit supplied - print full version string + elif (self.commit_count == 0 and not self.dirty): + return release + + dirty_status = '-dirty' if self.dirty else '' + return '%s-%s-g%s%s' % (release, self.commit_count if self.commit_count else 'x', + self.commit, dirty_status) + + def __repr__(self): + return str(self) + + def abbrev(self,dev_suffix=""): + """ + Abbreviated string representation, optionally declaring whether it is + a development version. + """ + return '.'.join(str(el) for el in self.release) + \ + (dev_suffix if self.commit_count > 0 or self.dirty else "") + + + def __eq__(self, other): + """ + Two versions are considered equivalent if and only if they are + from the same release, with the same commit count, and are not + dirty. Any dirty version is considered different from any + other version, since it could potentially have any arbitrary + changes even for the same release and commit count. + """ + if self.dirty or other.dirty: return False + return ((self.release, self.commit_count, self.dev) + == (other.release, other.commit_count, other.dev)) + + def __gt__(self, other): + if self.release == other.release: + if self.dev == other.dev: + return self.commit_count > other.commit_count + elif None in [self.dev, other.dev]: + return self.dev is None + else: + return self.dev > other.dev + else: + return (self.release, self.commit_count) > (other.release, other.commit_count) + + def __lt__(self, other): + if self==other: + return False + else: + return not (self > other) + + + def verify(self, string_version=None): + """ + Check that the version information is consistent with the VCS + before doing a release. If supplied with a string version, + this is also checked against the current version. Should be + called from setup.py with the declared package version before + releasing to PyPI. + """ + if string_version and string_version != str(self): + raise Exception("Supplied string version does not match current version.") + + if self.dirty: + raise Exception("Current working directory is dirty.") + + if self.release != self.expected_release: + raise Exception("Declared release does not match current release tag.") + + if self.commit_count !=0: + raise Exception("Please update the VCS version tag before release.") + + if self._expected_commit not in [None, "$Format:%h$"]: + raise Exception("Declared release does not match the VCS version tag") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/param-1.6.0/param.egg-info/PKG-INFO new/param-1.6.1/param.egg-info/PKG-INFO --- old/param-1.6.0/param.egg-info/PKG-INFO 2018-04-05 12:25:08.000000000 +0200 +++ new/param-1.6.1/param.egg-info/PKG-INFO 2018-04-25 17:55:48.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: param -Version: 1.6.0 +Version: 1.6.1 Summary: Declarative Python programming using Parameters. Home-page: http://ioam.github.com/param/ Author: IOAM
