From c2b5526b020967ff4cf7c5fd08d0d8483363095e Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 18 Jul 2013 14:39:45 -0400 Subject: initial debian packaging --- debian/changelog | 5 +++++ debian/clean | 1 + debian/compat | 1 + debian/control | 13 +++++++++++++ debian/copyright | 16 ++++++++++++++++ debian/doc | 2 ++ debian/files | 1 + debian/rules | 6 ++++++ debian/source/format | 1 + 9 files changed, 46 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/clean create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/doc create mode 100644 debian/files create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..fec9286 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +leap-keymanager (0.2.0) unstable; urgency=low + + * Initial debian package + + -- Micah Anderson Thu, 18 Jul 2013 14:08:30 -0400 diff --git a/debian/clean b/debian/clean new file mode 100644 index 0000000..8ea5a5b --- /dev/null +++ b/debian/clean @@ -0,0 +1 @@ +src/leap.keymanager.egg-info/* diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..e4be973 --- /dev/null +++ b/debian/control @@ -0,0 +1,13 @@ +Source: leap-keymanager +Maintainer: Micah Anderson +Section: python +Priority: optional +Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 9) +Standards-Version: 3.9.4 + +Package: leap-keymanager +Architecture: all +Depends: ${misc:Depends}, ${python:Depends} +Description: LEAP's Key Manager + The Key Manager handles all types of keys to allow for point-to-point + encryption between parties communicating through LEAP infrastructure. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..85071d3 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,16 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: python-leap.keyring +Upstream-Contact: info@leap.se +Source: + +Files: * +Copyright: Copyright (C) 2013 LEAP +License: GPL-3+ + +Files: debian/* +Copyright: Copyright 2013 Micah Anderson +License: GPL-3+ + +License: GPL-3+ + On Debian systems, the complete text of the GNU General + Public License can be found in `/usr/share/common-licenses/GPL'. diff --git a/debian/doc b/debian/doc new file mode 100644 index 0000000..ed089a7 --- /dev/null +++ b/debian/doc @@ -0,0 +1,2 @@ +README.rst +CHANGELOG diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..bae9bc1 --- /dev/null +++ b/debian/files @@ -0,0 +1 @@ +python-leap.keymanager_0.2.0-1_all.deb python optional diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..bcebae9 --- /dev/null +++ b/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +%: + dh $@ --with python2 --buildsystem=python_distutils + + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) -- cgit v1.2.3 From d4c8ce9ced9e416aa800f9deb8af42721d1f5a1c Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 13 Aug 2013 15:45:04 -0400 Subject: update to 0.3.0 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index fec9286..07756e7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +leap-keymanager (0.3.0) unstable; urgency=low + + * Update to 0.3.0 + + -- Micah Anderson Tue, 13 Aug 2013 15:44:26 -0400 + leap-keymanager (0.2.0) unstable; urgency=low * Initial debian package -- cgit v1.2.3 From 50b2cf99130f92d2ab4b12373116c6ca896f1a81 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 22 Aug 2013 15:21:00 -0400 Subject: note correct version of python-leap-common package in pydist-overrides --- debian/changelog | 1 + debian/pydist-overrides | 1 + 2 files changed, 2 insertions(+) create mode 100644 debian/pydist-overrides diff --git a/debian/changelog b/debian/changelog index 5800212..071c586 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ leap-keymanager (0.3.1pre) unstable; urgency=low * Merge new version to get soledad split + * Note correct package name for python-leap-common in pydist-overrides -- Micah Anderson Thu, 22 Aug 2013 15:13:03 -0400 diff --git a/debian/pydist-overrides b/debian/pydist-overrides new file mode 100644 index 0000000..ba38e00 --- /dev/null +++ b/debian/pydist-overrides @@ -0,0 +1 @@ +python-leap.common python-leap-common -- cgit v1.2.3 From f82457d8b3533dfa71b452cf1881ff3393368dd9 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 27 Aug 2013 12:25:20 -0400 Subject: prepare for 0.3.1 release of package --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 071c586..8c16005 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -leap-keymanager (0.3.1pre) unstable; urgency=low +leap-keymanager (0.3.1) unstable; urgency=low * Merge new version to get soledad split * Note correct package name for python-leap-common in pydist-overrides -- cgit v1.2.3 From 1ad3b9e2d9260ee0ba4df2c101ded0e3b3484c38 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 27 Aug 2013 19:53:20 +0200 Subject: add pydist-overrides for leap.common --- debian/files | 1 - debian/pydist-overrides | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 debian/files diff --git a/debian/files b/debian/files deleted file mode 100644 index bae9bc1..0000000 --- a/debian/files +++ /dev/null @@ -1 +0,0 @@ -python-leap.keymanager_0.2.0-1_all.deb python optional diff --git a/debian/pydist-overrides b/debian/pydist-overrides index ba38e00..7ac8231 100644 --- a/debian/pydist-overrides +++ b/debian/pydist-overrides @@ -1 +1 @@ -python-leap.common python-leap-common +leap.common python-leap-common -- cgit v1.2.3 From 07a9f42ccc6d61abd5f7edde491d500607c6c565 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 27 Aug 2013 20:14:21 +0200 Subject: update changelog --- debian/changelog | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 071c586..6205269 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,10 @@ -leap-keymanager (0.3.1pre) unstable; urgency=low +leap-keymanager (0.3.1) unstable; urgency=low + + * Update to 0.3.1 + + -- Micah Anderson Tue, 27 Aug 2013 20:12:43 +0200 + +leap-keymanager (0.3.1~pre) unstable; urgency=low * Merge new version to get soledad split * Note correct package name for python-leap-common in pydist-overrides -- cgit v1.2.3 From 8a8984d7bb7fec902ae12930fdb35bd636e078d6 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 27 Aug 2013 20:15:43 +0200 Subject: add pep386 flag --- debian/pydist-overrides | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/pydist-overrides b/debian/pydist-overrides index 7ac8231..e32eedb 100644 --- a/debian/pydist-overrides +++ b/debian/pydist-overrides @@ -1 +1 @@ -leap.common python-leap-common +leap.common python-leap-common ; PEP386 -- cgit v1.2.3 From 53a1700b0fbf514ff18572a65aff0df3045f64f4 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 27 Aug 2013 20:16:48 +0200 Subject: install our CHANGELOG --- debian/rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/rules b/debian/rules index bcebae9..2bdcd17 100755 --- a/debian/rules +++ b/debian/rules @@ -3,4 +3,7 @@ %: dh $@ --with python2 --buildsystem=python_distutils +override_dh_installchangelogs: + dh_installchangelogs CHANGELOG + -- cgit v1.2.3 From 22c91809fa03f3951b7a9395bebe01b07e28d1f6 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 12 Sep 2013 14:06:22 +0200 Subject: update version to 0.3.2 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 622e71c..e16768f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +leap-keymanager (0.3.2) unstable; urgency=low + + * Update to 0.3.2 + + -- Micah Anderson Thu, 12 Sep 2013 14:04:59 +0200 + leap-keymanager (0.3.1) unstable; urgency=low * Update to 0.3.1 -- cgit v1.2.3 From 4d863a4ea37af717eeda9914d05c201cbdf9f264 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 14 Oct 2013 03:20:59 -0300 Subject: bump changelog + update gnupg dep --- debian/changelog | 7 +++++++ debian/pydist-overrides | 1 + 2 files changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index e16768f..629f80f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +leap-keymanager (0.3.3) unstable; urgency=low + + * Update to 0.3.3 + * Change dependency to python-gnupg-ng + + -- Micah Anderson Mon, 14 Oct 2013 03:16:39 -0300 + leap-keymanager (0.3.2) unstable; urgency=low * Update to 0.3.2 diff --git a/debian/pydist-overrides b/debian/pydist-overrides index e32eedb..0fecd4c 100644 --- a/debian/pydist-overrides +++ b/debian/pydist-overrides @@ -1 +1,2 @@ leap.common python-leap-common ; PEP386 +gnupg python-gnupg-ng ; PEP386 -- cgit v1.2.3 From e5cb16babd981fdbb93ea67f70101861a1124ae7 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 30 Oct 2013 11:08:42 -0200 Subject: add freeze_debianver command --- setup.py | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 1e48931..778909d 100644 --- a/setup.py +++ b/setup.py @@ -17,6 +17,7 @@ """ setup file for leap.keymanager """ +import re from setuptools import setup from setuptools import find_packages @@ -42,17 +43,82 @@ trove_classifiers = [ 'Topic :: Software Development :: Libraries', ] +DOWNLOAD_BASE = ('https://github.com/leapcode/keymanager/' + 'archive/%s.tar.gz') +_versions = versioneer.get_versions() +VERSION = _versions['version'] +VERSION_FULL = _versions['full'] +DOWNLOAD_URL = "" + +# get the short version for the download url +_version_short = re.findall('\d+\.\d+\.\d+', VERSION) +if len(_version_short) > 0: + VERSION_SHORT = _version_short[0] + DOWNLOAD_URL = DOWNLOAD_BASE % VERSION_SHORT + +cmdclass = versioneer.get_cmdclass() + + +from setuptools import Command + + +class freeze_debianver(Command): + """ + Freezes the version in a debian branch. + To be used after merging the development branch onto the debian one. + """ + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + proceed = str(raw_input( + "This will overwrite the file _version.py. Continue? [y/N] ")) + if proceed != "y": + print("He. You scared. Aborting.") + return + template = r""" +# This file was generated by the `freeze_debianver` command in setup.py +# Using 'versioneer.py' (0.7+) from +# revision-control system data, or from the parent directory name of an +# unpacked source archive. Distribution tarballs contain a pre-generated copy +# of this file. + +version_version = '{version}' +version_full = '{version_full}' +""" + templatefun = r""" + +def get_versions(default={}, verbose=False): + return {'version': version_version, 'full': version_full} +""" + subst_template = template.format( + version=VERSION_SHORT, + version_full=VERSION_FULL) + templatefun + with open(versioneer.versionfile_source, 'w') as f: + f.write(subst_template) + + +cmdclass["freeze_debianver"] = freeze_debianver + # XXX add ref to docs setup( name='leap.keymanager', - version=versioneer.get_version(), - cmdclass=versioneer.get_cmdclass(), + version=VERSION, + cmdclass=cmdclass, url='https://leap.se/', + download_url=DOWNLOAD_URL, license='GPLv3+', description='LEAP\'s Key Manager', author='The LEAP Encryption Access Project', author_email='info@leap.se', + maintainer='Kali Kaneko', + maintainer_email='kali@leap.se', long_description=( "The Key Manager handles all types of keys to allow for " "point-to-point encryption between parties communicating through " -- cgit v1.2.3 From ddf5c623c46af4b2c28a34fed4ccc0581fe44d52 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 30 Oct 2013 15:50:04 -0200 Subject: 0.3.4 version freeze --- src/leap/keymanager/_version.py | 208 ++-------------------------------------- 1 file changed, 9 insertions(+), 199 deletions(-) diff --git a/src/leap/keymanager/_version.py b/src/leap/keymanager/_version.py index 3a514e1..5b2394a 100644 --- a/src/leap/keymanager/_version.py +++ b/src/leap/keymanager/_version.py @@ -1,203 +1,13 @@ -IN_LONG_VERSION_PY = True -# This file helps to compute a version number in source trees obtained from -# git-archive tarball (such as those provided by githubs download-from-tag -# feature). Distribution tarballs (build by setup.py sdist) and build -# directories (produced by setup.py build) will contain a much shorter file -# that just contains the computed version number. +# This file was generated by the `freeze_debianver` command in setup.py +# Using 'versioneer.py' (0.7+) from +# revision-control system data, or from the parent directory name of an +# unpacked source archive. Distribution tarballs contain a pre-generated copy +# of this file. -# This file is released into the public domain. Generated by -# versioneer-0.7+ (https://github.com/warner/python-versioneer) +version_version = '0.3.4' +version_full = '7d5e93253271ef10a0c497ff8e27ce597f6086e4' -# these strings will be replaced by git during git-archive -git_refnames = "$Format:%d$" -git_full = "$Format:%H$" - - -import subprocess -import sys - -def run_command(args, cwd=None, verbose=False): - try: - # remember shell=False, so use git.cmd on windows, not just git - p = subprocess.Popen(args, stdout=subprocess.PIPE, cwd=cwd) - except EnvironmentError: - e = sys.exc_info()[1] - if verbose: - print("unable to run %s" % args[0]) - print(e) - return None - stdout = p.communicate()[0].strip() - if sys.version >= '3': - stdout = stdout.decode() - if p.returncode != 0: - if verbose: - print("unable to run %s (error)" % args[0]) - return None - return stdout - - -import sys -import re -import os.path - -def get_expanded_variables(versionfile_source): - # the code embedded in _version.py can just fetch the value of these - # variables. When used from setup.py, we don't want to import - # _version.py, so we do it with a regexp instead. This function is not - # used from _version.py. - variables = {} - try: - f = open(versionfile_source,"r") - for line in f.readlines(): - if line.strip().startswith("git_refnames ="): - mo = re.search(r'=\s*"(.*)"', line) - if mo: - variables["refnames"] = mo.group(1) - if line.strip().startswith("git_full ="): - mo = re.search(r'=\s*"(.*)"', line) - if mo: - variables["full"] = mo.group(1) - f.close() - except EnvironmentError: - pass - return variables - -def versions_from_expanded_variables(variables, tag_prefix, verbose=False): - refnames = variables["refnames"].strip() - if refnames.startswith("$Format"): - if verbose: - print("variables are unexpanded, not using") - return {} # unexpanded, so not in an unpacked git-archive tarball - refs = set([r.strip() for r in refnames.strip("()").split(",")]) - # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of - # just "foo-1.0". If we see a "tag: " prefix, prefer those. - TAG = "tag: " - tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) - if not tags: - # Either we're using git < 1.8.3, or there really are no tags. We use - # a heuristic: assume all version tags have a digit. The old git %d - # expansion behaves like git log --decorate=short and strips out the - # refs/heads/ and refs/tags/ prefixes that would let us distinguish - # between branches and tags. By ignoring refnames without digits, we - # filter out many common branch names like "release" and - # "stabilization", as well as "HEAD" and "master". - tags = set([r for r in refs if re.search(r'\d', r)]) - if verbose: - print("discarding '%s', no digits" % ",".join(refs-tags)) - if verbose: - print("likely tags: %s" % ",".join(sorted(tags))) - for ref in sorted(tags): - # sorting will prefer e.g. "2.0" over "2.0rc1" - if ref.startswith(tag_prefix): - r = ref[len(tag_prefix):] - if verbose: - print("picking %s" % r) - return { "version": r, - "full": variables["full"].strip() } - # no suitable tags, so we use the full revision id - if verbose: - print("no suitable tags, using full revision id") - return { "version": variables["full"].strip(), - "full": variables["full"].strip() } - -def versions_from_vcs(tag_prefix, versionfile_source, verbose=False): - # this runs 'git' from the root of the source tree. That either means - # someone ran a setup.py command (and this code is in versioneer.py, so - # IN_LONG_VERSION_PY=False, thus the containing directory is the root of - # the source tree), or someone ran a project-specific entry point (and - # this code is in _version.py, so IN_LONG_VERSION_PY=True, thus the - # containing directory is somewhere deeper in the source tree). This only - # gets called if the git-archive 'subst' variables were *not* expanded, - # and _version.py hasn't already been rewritten with a short version - # string, meaning we're inside a checked out source tree. - - try: - here = os.path.abspath(__file__) - except NameError: - # some py2exe/bbfreeze/non-CPython implementations don't do __file__ - return {} # not always correct - - # versionfile_source is the relative path from the top of the source tree - # (where the .git directory might live) to this file. Invert this to find - # the root from __file__. - root = here - if IN_LONG_VERSION_PY: - for i in range(len(versionfile_source.split("/"))): - root = os.path.dirname(root) - else: - root = os.path.dirname(here) - if not os.path.exists(os.path.join(root, ".git")): - if verbose: - print("no .git in %s" % root) - return {} - - GIT = "git" - if sys.platform == "win32": - GIT = "git.cmd" - stdout = run_command([GIT, "describe", "--tags", "--dirty", "--always"], - cwd=root) - if stdout is None: - return {} - if not stdout.startswith(tag_prefix): - if verbose: - print("tag '%s' doesn't start with prefix '%s'" % (stdout, tag_prefix)) - return {} - tag = stdout[len(tag_prefix):] - stdout = run_command([GIT, "rev-parse", "HEAD"], cwd=root) - if stdout is None: - return {} - full = stdout.strip() - if tag.endswith("-dirty"): - full += "-dirty" - return {"version": tag, "full": full} - - -def versions_from_parentdir(parentdir_prefix, versionfile_source, verbose=False): - if IN_LONG_VERSION_PY: - # We're running from _version.py. If it's from a source tree - # (execute-in-place), we can work upwards to find the root of the - # tree, and then check the parent directory for a version string. If - # it's in an installed application, there's no hope. - try: - here = os.path.abspath(__file__) - except NameError: - # py2exe/bbfreeze/non-CPython don't have __file__ - return {} # without __file__, we have no hope - # versionfile_source is the relative path from the top of the source - # tree to _version.py. Invert this to find the root from __file__. - root = here - for i in range(len(versionfile_source.split("/"))): - root = os.path.dirname(root) - else: - # we're running from versioneer.py, which means we're running from - # the setup.py in a source tree. sys.argv[0] is setup.py in the root. - here = os.path.abspath(sys.argv[0]) - root = os.path.dirname(here) - - # Source tarballs conventionally unpack into a directory that includes - # both the project name and a version string. - dirname = os.path.basename(root) - if not dirname.startswith(parentdir_prefix): - if verbose: - print("guessing rootdir is '%s', but '%s' doesn't start with prefix '%s'" % - (root, dirname, parentdir_prefix)) - return None - return {"version": dirname[len(parentdir_prefix):], "full": ""} - -tag_prefix = "" -parentdir_prefix = "leap.keymanager-" -versionfile_source = "src/leap/keymanager/_version.py" - -def get_versions(default={"version": "unknown", "full": ""}, verbose=False): - variables = { "refnames": git_refnames, "full": git_full } - ver = versions_from_expanded_variables(variables, tag_prefix, verbose) - if not ver: - ver = versions_from_vcs(tag_prefix, versionfile_source, verbose) - if not ver: - ver = versions_from_parentdir(parentdir_prefix, versionfile_source, - verbose) - if not ver: - ver = default - return ver +def get_versions(default={}, verbose=False): + return {'version': version_version, 'full': version_full} -- cgit v1.2.3 From ef8a6a8894fb194e6546e72498cdfec9ab50d028 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 30 Oct 2013 15:52:26 -0200 Subject: update changelog to 0.3.4 --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 629f80f..66a7578 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +leap-keymanager (0.3.4) unstable; urgency=low + + * Update to 0.3.4 + * Version reported is 0.3.4 using freeze_debianver command. + + -- Micah Anderson Wed, 30 Oct 2013 15:50:19 -0200 + leap-keymanager (0.3.3) unstable; urgency=low * Update to 0.3.3 -- cgit v1.2.3 From f29288cef742aa68c502493582de454715d98595 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 5 Nov 2013 11:14:29 -0200 Subject: update changelog to 0.3.5 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 66a7578..e667fd9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +leap-keymanager (0.3.5) unstable; urgency=low + + * Update to 0.3.5 release. + + -- Ben Carrillo Tue, 05 Nov 2013 11:13:40 -0200 + leap-keymanager (0.3.4) unstable; urgency=low * Update to 0.3.4 -- cgit v1.2.3 From e7e64a88ac65917bd8950b0ce16aad949823f7c6 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 5 Nov 2013 11:15:30 -0200 Subject: freeze debian ver to 0.3.5 --- src/leap/keymanager/_version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/leap/keymanager/_version.py b/src/leap/keymanager/_version.py index 5b2394a..2d4f99c 100644 --- a/src/leap/keymanager/_version.py +++ b/src/leap/keymanager/_version.py @@ -5,8 +5,8 @@ # unpacked source archive. Distribution tarballs contain a pre-generated copy # of this file. -version_version = '0.3.4' -version_full = '7d5e93253271ef10a0c497ff8e27ce597f6086e4' +version_version = '0.3.5' +version_full = 'f29288cef742aa68c502493582de454715d98595' def get_versions(default={}, verbose=False): -- cgit v1.2.3 From dbe634b360b8d6666e584a28e344ca2510209f2f Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Fri, 15 Nov 2013 23:33:27 -0200 Subject: update changelog to 0.3.6 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index e667fd9..d9ee66c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +leap-keymanager (0.3.6) unstable; urgency=low + + * Update to 0.3.6 release. + + -- Ben Carrillo Fri, 15 Nov 2013 23:32:40 -0200 + leap-keymanager (0.3.5) unstable; urgency=low * Update to 0.3.5 release. -- cgit v1.2.3 From f5de4bdecb24664ec1f3ba1172829bcad32f3abc Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Fri, 15 Nov 2013 23:34:05 -0200 Subject: improve deb release script --- deb_release.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 deb_release.sh diff --git a/deb_release.sh b/deb_release.sh new file mode 100755 index 0000000..c84e2e6 --- /dev/null +++ b/deb_release.sh @@ -0,0 +1,8 @@ +#!/bin/zsh + +VERSION_FILE="src/leap/keymanager/_version.py" +rm ${VERSION_FILE} +python setup.py freeze_debianver +sed -i 's/-dirty//g' ${VERSION_FILE} +git add ${VERSION_FILE} +git ci -m "freeze debian version" -- cgit v1.2.3 From 99ee292afceac503f96689906351b84ca64265b7 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Fri, 15 Nov 2013 23:34:09 -0200 Subject: freeze debian version --- src/leap/keymanager/_version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/leap/keymanager/_version.py b/src/leap/keymanager/_version.py index 2d4f99c..e0fb020 100644 --- a/src/leap/keymanager/_version.py +++ b/src/leap/keymanager/_version.py @@ -5,8 +5,8 @@ # unpacked source archive. Distribution tarballs contain a pre-generated copy # of this file. -version_version = '0.3.5' -version_full = 'f29288cef742aa68c502493582de454715d98595' +version_version = '0.3.6' +version_full = 'f5de4bdecb24664ec1f3ba1172829bcad32f3abc' def get_versions(default={}, verbose=False): -- cgit v1.2.3 From 3ae3c8153b8f4237470b1f46bd6f545215c3cd0a Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 10 Dec 2013 15:47:59 -0400 Subject: freeze debian version --- src/leap/keymanager/_version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/leap/keymanager/_version.py b/src/leap/keymanager/_version.py index e0fb020..6beeff5 100644 --- a/src/leap/keymanager/_version.py +++ b/src/leap/keymanager/_version.py @@ -5,8 +5,8 @@ # unpacked source archive. Distribution tarballs contain a pre-generated copy # of this file. -version_version = '0.3.6' -version_full = 'f5de4bdecb24664ec1f3ba1172829bcad32f3abc' +version_version = '0.3.7' +version_full = 'ee2bedef370e9a229ef1805a336c35d967f0abdf' def get_versions(default={}, verbose=False): -- cgit v1.2.3 From 441b7a40e1e41993d3909ebeab520b59058a6112 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 10 Dec 2013 16:21:45 -0400 Subject: bump changelog to 0.3.7 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index d9ee66c..4c666cb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +leap-keymanager (0.3.7) unstable; urgency=low + + * Update to 0.3.7 release + + -- Ben Carrillo Tue, 10 Dec 2013 16:21:13 -0400 + leap-keymanager (0.3.6) unstable; urgency=low * Update to 0.3.6 release. -- cgit v1.2.3 From 0929d3953191e7ad5ec51f3e94ad6d7608428d48 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 23 Dec 2013 02:22:27 -0400 Subject: update changelog to 0.3.8 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 4c666cb..c2bd5b6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +leap-keymanager (0.3.8~rc) unstable; urgency=low + + * Update to 0.3.8 rc release. + + -- Ben Carrillo Mon, 23 Dec 2013 02:21:54 -0400 + leap-keymanager (0.3.7) unstable; urgency=low * Update to 0.3.7 release -- cgit v1.2.3 From d7efe9e5c802db08bdb0a75c168527572cbdf255 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 23 Dec 2013 02:22:34 -0400 Subject: freeze debian version to 0.3.8-rc1 --- src/leap/keymanager/_version.py | 214 ++-------------------------------------- 1 file changed, 9 insertions(+), 205 deletions(-) diff --git a/src/leap/keymanager/_version.py b/src/leap/keymanager/_version.py index 28fca96..de3a5a2 100644 --- a/src/leap/keymanager/_version.py +++ b/src/leap/keymanager/_version.py @@ -1,209 +1,13 @@ -IN_LONG_VERSION_PY = True -# This file helps to compute a version number in source trees obtained from -# git-archive tarball (such as those provided by githubs download-from-tag -# feature). Distribution tarballs (build by setup.py sdist) and build -# directories (produced by setup.py build) will contain a much shorter file -# that just contains the computed version number. +# This file was generated by the `freeze_debianver` command in setup.py +# Using 'versioneer.py' (0.7+) from +# revision-control system data, or from the parent directory name of an +# unpacked source archive. Distribution tarballs contain a pre-generated copy +# of this file. -# This file is released into the public domain. Generated by -# versioneer-0.7+ (https://github.com/warner/python-versioneer) +version_version = '0.3.8-rc1' +version_full = '0929d3953191e7ad5ec51f3e94ad6d7608428d48' -# these strings will be replaced by git during git-archive -git_refnames = "$Format:%d$" -git_full = "$Format:%H$" - -import subprocess -import sys - - -def run_command(args, cwd=None, verbose=False): - try: - # remember shell=False, so use git.cmd on windows, not just git - p = subprocess.Popen(args, stdout=subprocess.PIPE, cwd=cwd) - except EnvironmentError: - e = sys.exc_info()[1] - if verbose: - print("unable to run %s" % args[0]) - print(e) - return None - stdout = p.communicate()[0].strip() - if sys.version >= '3': - stdout = stdout.decode() - if p.returncode != 0: - if verbose: - print("unable to run %s (error)" % args[0]) - return None - return stdout - - -import re -import os.path - - -def get_expanded_variables(versionfile_source): - # the code embedded in _version.py can just fetch the value of these - # variables. When used from setup.py, we don't want to import - # _version.py, so we do it with a regexp instead. This function is not - # used from _version.py. - variables = {} - try: - f = open(versionfile_source, "r") - for line in f.readlines(): - if line.strip().startswith("git_refnames ="): - mo = re.search(r'=\s*"(.*)"', line) - if mo: - variables["refnames"] = mo.group(1) - if line.strip().startswith("git_full ="): - mo = re.search(r'=\s*"(.*)"', line) - if mo: - variables["full"] = mo.group(1) - f.close() - except EnvironmentError: - pass - return variables - - -def versions_from_expanded_variables(variables, tag_prefix, verbose=False): - refnames = variables["refnames"].strip() - if refnames.startswith("$Format"): - if verbose: - print("variables are unexpanded, not using") - return {} # unexpanded, so not in an unpacked git-archive tarball - refs = set([r.strip() for r in refnames.strip("()").split(",")]) - # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of - # just "foo-1.0". If we see a "tag: " prefix, prefer those. - TAG = "tag: " - tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) - if not tags: - # Either we're using git < 1.8.3, or there really are no tags. We use - # a heuristic: assume all version tags have a digit. The old git %d - # expansion behaves like git log --decorate=short and strips out the - # refs/heads/ and refs/tags/ prefixes that would let us distinguish - # between branches and tags. By ignoring refnames without digits, we - # filter out many common branch names like "release" and - # "stabilization", as well as "HEAD" and "master". - tags = set([r for r in refs if re.search(r'\d', r)]) - if verbose: - print("discarding '%s', no digits" % ",".join(refs-tags)) - if verbose: - print("likely tags: %s" % ",".join(sorted(tags))) - for ref in sorted(tags): - # sorting will prefer e.g. "2.0" over "2.0rc1" - if ref.startswith(tag_prefix): - r = ref[len(tag_prefix):] - if verbose: - print("picking %s" % r) - return {"version": r, - "full": variables["full"].strip()} - # no suitable tags, so we use the full revision id - if verbose: - print("no suitable tags, using full revision id") - return {"version": variables["full"].strip(), - "full": variables["full"].strip()} - - -def versions_from_vcs(tag_prefix, versionfile_source, verbose=False): - # this runs 'git' from the root of the source tree. That either means - # someone ran a setup.py command (and this code is in versioneer.py, so - # IN_LONG_VERSION_PY=False, thus the containing directory is the root of - # the source tree), or someone ran a project-specific entry point (and - # this code is in _version.py, so IN_LONG_VERSION_PY=True, thus the - # containing directory is somewhere deeper in the source tree). This only - # gets called if the git-archive 'subst' variables were *not* expanded, - # and _version.py hasn't already been rewritten with a short version - # string, meaning we're inside a checked out source tree. - - try: - here = os.path.abspath(__file__) - except NameError: - # some py2exe/bbfreeze/non-CPython implementations don't do __file__ - return {} # not always correct - - # versionfile_source is the relative path from the top of the source tree - # (where the .git directory might live) to this file. Invert this to find - # the root from __file__. - root = here - if IN_LONG_VERSION_PY: - for i in range(len(versionfile_source.split("/"))): - root = os.path.dirname(root) - else: - root = os.path.dirname(here) - if not os.path.exists(os.path.join(root, ".git")): - if verbose: - print("no .git in %s" % root) - return {} - - GIT = "git" - if sys.platform == "win32": - GIT = "git.cmd" - stdout = run_command([GIT, "describe", "--tags", "--dirty", "--always"], - cwd=root) - if stdout is None: - return {} - if not stdout.startswith(tag_prefix): - if verbose: - print("tag '%s' doesn't start with prefix '%s'" % - (stdout, tag_prefix)) - return {} - tag = stdout[len(tag_prefix):] - stdout = run_command([GIT, "rev-parse", "HEAD"], cwd=root) - if stdout is None: - return {} - full = stdout.strip() - if tag.endswith("-dirty"): - full += "-dirty" - return {"version": tag, "full": full} - - -def versions_from_parentdir(parentdir_prefix, versionfile_source, - verbose=False): - if IN_LONG_VERSION_PY: - # We're running from _version.py. If it's from a source tree - # (execute-in-place), we can work upwards to find the root of the - # tree, and then check the parent directory for a version string. If - # it's in an installed application, there's no hope. - try: - here = os.path.abspath(__file__) - except NameError: - # py2exe/bbfreeze/non-CPython don't have __file__ - return {} # without __file__, we have no hope - # versionfile_source is the relative path from the top of the source - # tree to _version.py. Invert this to find the root from __file__. - root = here - for i in range(len(versionfile_source.split("/"))): - root = os.path.dirname(root) - else: - # we're running from versioneer.py, which means we're running from - # the setup.py in a source tree. sys.argv[0] is setup.py in the root. - here = os.path.abspath(sys.argv[0]) - root = os.path.dirname(here) - - # Source tarballs conventionally unpack into a directory that includes - # both the project name and a version string. - dirname = os.path.basename(root) - if not dirname.startswith(parentdir_prefix): - if verbose: - print("guessing rootdir is '%s', but '%s' doesn't start " - "with prefix '%s'" % - (root, dirname, parentdir_prefix)) - return None - return {"version": dirname[len(parentdir_prefix):], "full": ""} - -tag_prefix = "" -parentdir_prefix = "leap.keymanager-" -versionfile_source = "src/leap/keymanager/_version.py" - - -def get_versions(default={"version": "unknown", "full": ""}, verbose=False): - variables = {"refnames": git_refnames, "full": git_full} - ver = versions_from_expanded_variables(variables, tag_prefix, verbose) - if not ver: - ver = versions_from_vcs(tag_prefix, versionfile_source, verbose) - if not ver: - ver = versions_from_parentdir(parentdir_prefix, versionfile_source, - verbose) - if not ver: - ver = default - return ver +def get_versions(default={}, verbose=False): + return {'version': version_version, 'full': version_full} -- cgit v1.2.3 From 9c3c2ea07eb0d833765220e690d4ecd2b7b3cf40 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 23 Dec 2013 02:24:27 -0400 Subject: bump reqs to unified release --- pkg/requirements.pip | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/requirements.pip b/pkg/requirements.pip index 1515204..0cbdf57 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -1,6 +1,6 @@ -leap.common>=0.3.0 +leap.common>=0.3.6.99 simplejson requests # if we bump the gnupg version, bump also the sanity check # in keymanager.__init__ -gnupg>=1.2.3 +gnupg>=1.2.4.99 -- cgit v1.2.3 From 96595db30aad79731be39cc62a1b2a8f8ebdddf3 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 9 Apr 2014 14:40:30 -0500 Subject: update changelog entry to 0.3.8 --- debian/changelog | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index c2bd5b6..c0c5a9c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -leap-keymanager (0.3.8~rc) unstable; urgency=low +leap-keymanager (0.3.8) unstable; urgency=low - * Update to 0.3.8 rc release. + * Update to 0.3.8 release. - -- Ben Carrillo Mon, 23 Dec 2013 02:21:54 -0400 + -- Ben Carrillo Wed, 09 Apr 2014 14:39:30 -0500 leap-keymanager (0.3.7) unstable; urgency=low -- cgit v1.2.3 From 94ccb31a9e7e90caffb1ded4c34baf804ccf31f9 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 9 Apr 2014 14:41:26 -0500 Subject: bump debian ver to 0.3.8 --- src/leap/keymanager/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/leap/keymanager/_version.py b/src/leap/keymanager/_version.py index de3a5a2..ad54645 100644 --- a/src/leap/keymanager/_version.py +++ b/src/leap/keymanager/_version.py @@ -5,7 +5,7 @@ # unpacked source archive. Distribution tarballs contain a pre-generated copy # of this file. -version_version = '0.3.8-rc1' +version_version = '0.3.8' version_full = '0929d3953191e7ad5ec51f3e94ad6d7608428d48' -- cgit v1.2.3 From 73e662f8741b5857b3881eb0ce7c08147a06a2bc Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 9 Apr 2014 14:43:55 -0500 Subject: update standards ver --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index e4be973..e8baeb5 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Maintainer: Micah Anderson Section: python Priority: optional Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 9) -Standards-Version: 3.9.4 +Standards-Version: 3.9.5 Package: leap-keymanager Architecture: all -- cgit v1.2.3 From d7acaf356d16c795f1481fefc7a75ffc8a36b1d0 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Fri, 26 Jun 2015 18:12:22 +0200 Subject: [bug] remove the dependency on enum34 * Resolves: #7188 --- changes/bug-7188_rm_enum34 | 1 + pkg/requirements.pip | 1 - src/leap/keymanager/__init__.py | 14 +++--- src/leap/keymanager/keys.py | 10 ++-- src/leap/keymanager/tests/test_keymanager.py | 13 ++--- src/leap/keymanager/tests/test_validation.py | 18 +++---- src/leap/keymanager/validation.py | 73 +++++++++++++++++++--------- 7 files changed, 78 insertions(+), 52 deletions(-) create mode 100644 changes/bug-7188_rm_enum34 diff --git a/changes/bug-7188_rm_enum34 b/changes/bug-7188_rm_enum34 new file mode 100644 index 0000000..4788df1 --- /dev/null +++ b/changes/bug-7188_rm_enum34 @@ -0,0 +1 @@ +- remove the dependency on enum34 (Closes: #7188) diff --git a/pkg/requirements.pip b/pkg/requirements.pip index c81c1a1..1aef332 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -4,4 +4,3 @@ requests # if we bump the gnupg version, bump also the sanity check # in keymanager.__init__ gnupg>=1.4.0 -enum34 diff --git a/src/leap/keymanager/__init__.py b/src/leap/keymanager/__init__.py index 47f479b..c2d7409 100644 --- a/src/leap/keymanager/__init__.py +++ b/src/leap/keymanager/__init__.py @@ -57,7 +57,7 @@ from leap.keymanager.errors import ( UnsupportedKeyTypeError, InvalidSignature ) -from leap.keymanager.validation import ValidationLevel, can_upgrade +from leap.keymanager.validation import ValidationLevels, can_upgrade from leap.keymanager.keys import ( build_key_from_dict, @@ -224,10 +224,10 @@ class KeyManager(object): if self.OPENPGP_KEY in server_keys: # nicknym server is authoritative for its own domain, # for other domains the key might come from key servers. - validation_level = ValidationLevel.Weak_Chain + validation_level = ValidationLevels.Weak_Chain _, domain = _split_email(address) if (domain == _get_domain(self._nickserver_uri)): - validation_level = ValidationLevel.Provider_Trust + validation_level = ValidationLevels.Provider_Trust d = self.put_raw_key( server_keys['openpgp'], @@ -712,7 +712,7 @@ class KeyManager(object): return d def put_raw_key(self, key, ktype, address, - validation=ValidationLevel.Weak_Chain): + validation=ValidationLevels.Weak_Chain): """ Put raw key bound to address in local storage. @@ -724,7 +724,7 @@ class KeyManager(object): :type address: str :param validation: validation level for this key (default: 'Weak_Chain') - :type validation: ValidationLevel + :type validation: ValidationLevels :return: A Deferred which fires when the key is in the storage, or which fails with KeyAddressMismatch if address doesn't match @@ -744,7 +744,7 @@ class KeyManager(object): return d def fetch_key(self, address, uri, ktype, - validation=ValidationLevel.Weak_Chain): + validation=ValidationLevels.Weak_Chain): """ Fetch a public key bound to address from the network and put it in local storage. @@ -757,7 +757,7 @@ class KeyManager(object): :type ktype: subclass of EncryptionKey :param validation: validation level for this key (default: 'Weak_Chain') - :type validation: ValidationLevel + :type validation: ValidationLevels :return: A Deferred which fires when the key is in the storage, or which fails with KeyNotFound: if not valid key on uri or fails diff --git a/src/leap/keymanager/keys.py b/src/leap/keymanager/keys.py index 562c0a9..91559c2 100644 --- a/src/leap/keymanager/keys.py +++ b/src/leap/keymanager/keys.py @@ -35,7 +35,7 @@ from datetime import datetime from leap.common.check import leap_assert from twisted.internet import defer -from leap.keymanager.validation import ValidationLevel, toValidationLevel +from leap.keymanager.validation import ValidationLevels logger = logging.getLogger(__name__) @@ -120,11 +120,11 @@ def build_key_from_dict(kClass, kdict): :rtype: C{kClass} """ try: - validation = toValidationLevel(kdict[KEY_VALIDATION_KEY]) + validation = ValidationLevels.get(kdict[KEY_VALIDATION_KEY]) except ValueError: logger.error("Not valid validation level (%s) for key %s", (kdict[KEY_VALIDATION_KEY], kdict[KEY_ID_KEY])) - validation = ValidationLevel.Weak_Chain + validation = ValidationLevels.Weak_Chain expiry_date = _to_datetime(kdict[KEY_EXPIRY_DATE_KEY]) last_audited_at = _to_datetime(kdict[KEY_LAST_AUDITED_AT_KEY]) @@ -176,7 +176,7 @@ class EncryptionKey(object): def __init__(self, address, key_id="", fingerprint="", key_data="", private=False, length=0, expiry_date=None, - validation=ValidationLevel.Weak_Chain, last_audited_at=None, + validation=ValidationLevels.Weak_Chain, last_audited_at=None, refreshed_at=None, encr_used=False, sign_used=False): self.address = address self.key_id = key_id @@ -213,7 +213,7 @@ class EncryptionKey(object): KEY_EXPIRY_DATE_KEY: expiry_date, KEY_LAST_AUDITED_AT_KEY: last_audited_at, KEY_REFRESHED_AT_KEY: refreshed_at, - KEY_VALIDATION_KEY: self.validation.name, + KEY_VALIDATION_KEY: str(self.validation), KEY_ENCR_USED_KEY: self.encr_used, KEY_SIGN_USED_KEY: self.sign_used, KEY_TAGS_KEY: [KEYMANAGER_KEY_TAG], diff --git a/src/leap/keymanager/tests/test_keymanager.py b/src/leap/keymanager/tests/test_keymanager.py index 55f892e..08d3750 100644 --- a/src/leap/keymanager/tests/test_keymanager.py +++ b/src/leap/keymanager/tests/test_keymanager.py @@ -36,10 +36,7 @@ from leap.keymanager.keys import ( is_address, build_key_from_dict, ) -from leap.keymanager.validation import ( - ValidationLevel, - toValidationLevel -) +from leap.keymanager.validation import ValidationLevels from leap.keymanager.tests import ( KeyManagerWithSoledadTestCase, ADDRESS, @@ -82,7 +79,7 @@ class KeyManagerUtilTestCase(unittest.TestCase): 'expiry_date': 0, 'last_audited_at': 0, 'refreshed_at': 1311239602, - 'validation': ValidationLevel.Weak_Chain.name, + 'validation': str(ValidationLevels.Weak_Chain), 'encr_used': False, 'sign_used': True, } @@ -115,7 +112,7 @@ class KeyManagerUtilTestCase(unittest.TestCase): datetime.fromtimestamp(kdict['refreshed_at']), key.refreshed_at, 'Wrong data in key.') self.assertEqual( - toValidationLevel(kdict['validation']), key.validation, + ValidationLevels.get(kdict['validation']), key.validation, 'Wrong data in key.') self.assertEqual( kdict['encr_used'], key.encr_used, @@ -227,7 +224,7 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase): key = yield self._fetch_key(km, ADDRESS, PUBLIC_KEY) self.assertIsInstance(key, OpenPGPKey) self.assertTrue(ADDRESS in key.address) - self.assertEqual(key.validation, ValidationLevel.Provider_Trust) + self.assertEqual(key.validation, ValidationLevels.Provider_Trust) @inlineCallbacks def test_get_key_fetches_other_domain(self): @@ -239,7 +236,7 @@ class KeyManagerKeyManagementTestCase(KeyManagerWithSoledadTestCase): key = yield self._fetch_key(km, ADDRESS_OTHER, PUBLIC_KEY_OTHER) self.assertIsInstance(key, OpenPGPKey) self.assertTrue(ADDRESS_OTHER in key.address) - self.assertEqual(key.validation, ValidationLevel.Weak_Chain) + self.assertEqual(key.validation, ValidationLevels.Weak_Chain) def _fetch_key(self, km, address, key): """ diff --git a/src/leap/keymanager/tests/test_validation.py b/src/leap/keymanager/tests/test_validation.py index 15e7d27..0c1d155 100644 --- a/src/leap/keymanager/tests/test_validation.py +++ b/src/leap/keymanager/tests/test_validation.py @@ -31,10 +31,10 @@ from leap.keymanager.tests import ( PUBLIC_KEY, KEY_FINGERPRINT ) -from leap.keymanager.validation import ValidationLevel +from leap.keymanager.validation import ValidationLevels -class ValidationLevelTestCase(KeyManagerWithSoledadTestCase): +class ValidationLevelsTestCase(KeyManagerWithSoledadTestCase): @inlineCallbacks def test_none_old_key(self): @@ -47,7 +47,7 @@ class ValidationLevelTestCase(KeyManagerWithSoledadTestCase): def test_cant_upgrade(self): km = self._key_manager() yield km.put_raw_key(PUBLIC_KEY, OpenPGPKey, ADDRESS, - validation=ValidationLevel.Provider_Trust) + validation=ValidationLevels.Provider_Trust) d = km.put_raw_key(UNRELATED_KEY, OpenPGPKey, ADDRESS) yield self.assertFailure(d, KeyNotValidUpgrade) @@ -56,7 +56,7 @@ class ValidationLevelTestCase(KeyManagerWithSoledadTestCase): km = self._key_manager() yield km.put_raw_key(PUBLIC_KEY, OpenPGPKey, ADDRESS) yield km.put_raw_key(UNRELATED_KEY, OpenPGPKey, ADDRESS, - validation=ValidationLevel.Fingerprint) + validation=ValidationLevels.Fingerprint) key = yield km.get_key(ADDRESS, OpenPGPKey, fetch_remote=False) self.assertEqual(key.fingerprint, UNRELATED_FINGERPRINT) @@ -73,12 +73,12 @@ class ValidationLevelTestCase(KeyManagerWithSoledadTestCase): km = self._key_manager() yield km.put_raw_key( EXPIRED_KEY, OpenPGPKey, ADDRESS, - validation=ValidationLevel.Third_Party_Endorsement) + validation=ValidationLevels.Third_Party_Endorsement) d = km.put_raw_key( UNRELATED_KEY, OpenPGPKey, ADDRESS, - validation=ValidationLevel.Provider_Trust) + validation=ValidationLevels.Provider_Trust) yield self.assertFailure(d, KeyNotValidUpgrade) @inlineCallbacks @@ -93,9 +93,9 @@ class ValidationLevelTestCase(KeyManagerWithSoledadTestCase): def test_not_used(self): km = self._key_manager() yield km.put_raw_key(UNEXPIRED_KEY, OpenPGPKey, ADDRESS, - validation=ValidationLevel.Provider_Trust) + validation=ValidationLevels.Provider_Trust) yield km.put_raw_key(UNRELATED_KEY, OpenPGPKey, ADDRESS, - validation=ValidationLevel.Provider_Endorsement) + validation=ValidationLevels.Provider_Endorsement) key = yield km.get_key(ADDRESS, OpenPGPKey, fetch_remote=False) self.assertEqual(key.fingerprint, UNRELATED_FINGERPRINT) @@ -114,7 +114,7 @@ class ValidationLevelTestCase(KeyManagerWithSoledadTestCase): yield km.verify(TEXT, ADDRESS, OpenPGPKey, detached_sig=signature) d = km.put_raw_key( UNRELATED_KEY, OpenPGPKey, ADDRESS, - validation=ValidationLevel.Provider_Endorsement) + validation=ValidationLevels.Provider_Endorsement) yield self.assertFailure(d, KeyNotValidUpgrade) @inlineCallbacks diff --git a/src/leap/keymanager/validation.py b/src/leap/keymanager/validation.py index dfe6432..3bb4032 100644 --- a/src/leap/keymanager/validation.py +++ b/src/leap/keymanager/validation.py @@ -24,34 +24,63 @@ See: from datetime import datetime -from enum import IntEnum -ValidationLevel = IntEnum("ValidationLevel", - "Weak_Chain " - "Provider_Trust " - "Provider_Endorsement " - "Third_Party_Endorsement " - "Third_Party_Consensus " - "Historically_Auditing " - "Known_Key " - "Fingerprint") +class ValidationLevel(object): + """ + A validation level + + Meant to be used to compare levels or get it's string representation. + """ + def __init__(self, name, value): + self.name = name + self.value = value + + def __cmp__(self, other): + return cmp(self.value, other.value) + + def __str__(self): + return self.name + + def __repr__(self): + return "" % (self.name, self.value) -def toValidationLevel(value): +class _ValidationLevels(object): """ - Convert a string representation of a validation level into - C{ValidationLevel} + Handler class to manage validation levels. It should have only one global + instance 'ValidationLevels'. - :param value: validation level - :type value: str - :rtype: ValidationLevel - :raises ValueError: if C{value} is not a validation level + The levels are attributes of the instance and can be used like: + ValidationLevels.Weak_Chain + ValidationLevels.get("Weak_Chain") """ - for level in ValidationLevel: - if value == level.name: - return level - raise ValueError("Not valid validation level: %s" % (value,)) + _level_names = ("Weak_Chain", + "Provider_Trust", + "Provider_Endorsement", + "Third_Party_Endorsement", + "Third_Party_Consensus", + "Historically_Auditing", + "Known_Key", + "Fingerprint") + + def __init__(self): + for name in self._level_names: + setattr(self, name, + ValidationLevel(name, self._level_names.index(name))) + + def get(self, name): + """ + Get the ValidationLevel of a name + + :param name: name of the level + :type name: str + :rtype: ValidationLevel + """ + return getattr(self, name) + + +ValidationLevels = _ValidationLevels() def can_upgrade(new_key, old_key): @@ -69,7 +98,7 @@ def can_upgrade(new_key, old_key): return True # Manually verified fingerprint - if new_key.validation == ValidationLevel.Fingerprint: + if new_key.validation == ValidationLevels.Fingerprint: return True # Expired key and higher validation level -- cgit v1.2.3 From ec0757c5972588d05224ea2d56d75ee9cd57c41f Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 29 Jun 2015 12:05:51 -0400 Subject: [style] spelling typo --- src/leap/keymanager/validation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/leap/keymanager/validation.py b/src/leap/keymanager/validation.py index 3bb4032..734cfce 100644 --- a/src/leap/keymanager/validation.py +++ b/src/leap/keymanager/validation.py @@ -30,7 +30,7 @@ class ValidationLevel(object): """ A validation level - Meant to be used to compare levels or get it's string representation. + Meant to be used to compare levels or get its string representation. """ def __init__(self, name, value): self.name = name -- cgit v1.2.3 From 3c229540510fd9af27b6a4c473ebc68a1ee468c5 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Fri, 10 Jul 2015 14:44:19 -0300 Subject: [pkg] fold in changes --- CHANGELOG | 3 +++ changes/bug-7188_rm_enum34 | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) delete mode 100644 changes/bug-7188_rm_enum34 diff --git a/CHANGELOG b/CHANGELOG index 381e4e7..6b25f47 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +0.4.1 Jul 10, 2015: + o Remove the dependency on enum34. Closes: #7188. + 0.4.0 Jun 8, 2015: o Adapt to new events api on leap.common. Related to #5359. o Add 'fetch_key' method to fetch keys from a URI. Closes #5932. diff --git a/changes/bug-7188_rm_enum34 b/changes/bug-7188_rm_enum34 deleted file mode 100644 index 4788df1..0000000 --- a/changes/bug-7188_rm_enum34 +++ /dev/null @@ -1 +0,0 @@ -- remove the dependency on enum34 (Closes: #7188) -- cgit v1.2.3 From 9c79c40930b3f1a031ab3b157ce702eecedad8af Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 22 Jul 2015 10:31:59 -0400 Subject: [pkg] separate leap requirements this is part of a process to make the setup of the development mode less troublesome. from now on, setting up a virtualenv in pure development mode will be as easy as telling pip to just install the external dependencies:: pip install -r pkg/requirements.pip and traversing all the leap repos for the needed leap dependencies doing:: python setup.py develop - Related: #7288 --- pkg/requirements-leap.pip | 1 + pkg/requirements.pip | 5 ++--- pkg/utils.py | 11 +++++++---- setup.py | 6 +++++- 4 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 pkg/requirements-leap.pip diff --git a/pkg/requirements-leap.pip b/pkg/requirements-leap.pip new file mode 100644 index 0000000..b311859 --- /dev/null +++ b/pkg/requirements-leap.pip @@ -0,0 +1 @@ +leap.common>=0.4.0 diff --git a/pkg/requirements.pip b/pkg/requirements.pip index 1aef332..c4cb09a 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -1,6 +1,5 @@ -leap.common>=0.4.0 -simplejson -requests # if we bump the gnupg version, bump also the sanity check # in keymanager.__init__ gnupg>=1.4.0 +simplejson +requests diff --git a/pkg/utils.py b/pkg/utils.py index deace14..dd3deac 100644 --- a/pkg/utils.py +++ b/pkg/utils.py @@ -27,7 +27,7 @@ import sys def get_reqs_from_files(reqfiles): """ Returns the contents of the top requirement file listed as a - string list with the lines + string list with the lines. @param reqfiles: requirement files to parse @type reqfiles: list of str @@ -43,6 +43,9 @@ def parse_requirements(reqfiles=['requirements.txt', """ Parses the requirement files provided. + The passed reqfiles list is a list of possible locations to try, the + function will return the contents of the first path found. + Checks the value of LEAP_VENV_SKIP_PYSIDE to see if it should return PySide as a dep or not. Don't set, or set to 0 if you want to install it through pip. @@ -58,9 +61,9 @@ def parse_requirements(reqfiles=['requirements.txt', if re.match(r'\s*-e\s+', line): pass # do not try to do anything with externals on vcs - #requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', - #line)) - # http://foo.bar/baz/foobar/zipball/master#egg=foobar + # requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', + # line)) + # http://foo.bar/baz/foobar/zipball/master#egg=foobar elif re.match(r'\s*https?:', line): requirements.append(re.sub(r'\s*https?:.*#egg=(.*)$', r'\1', line)) diff --git a/setup.py b/setup.py index 778909d..f554e09 100644 --- a/setup.py +++ b/setup.py @@ -107,6 +107,10 @@ cmdclass["freeze_debianver"] = freeze_debianver # XXX add ref to docs +requirements = ( + utils.parse_requirements() + + utils.parse_requirements(reqfiles=["pkg/requirements-leap.pip"])) + setup( name='leap.keymanager', version=VERSION, @@ -129,7 +133,7 @@ setup( packages=find_packages('src', exclude=['leap.keymanager.tests']), package_dir={'': 'src'}, test_suite='leap.keymanager.tests', - install_requires=utils.parse_requirements(), + install_requires=requirements, tests_require=utils.parse_requirements( reqfiles=['pkg/requirements-testing.pip']), ) -- cgit v1.2.3 From 0c53c7f3fd76895cbb355bdc71818ae26af73432 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 22 Jul 2015 10:34:21 -0400 Subject: [style] add the magnificient leap commit template --- docs/leap-commit-template | 7 ++++++ docs/leap-commit-template.README | 47 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 docs/leap-commit-template create mode 100644 docs/leap-commit-template.README diff --git a/docs/leap-commit-template b/docs/leap-commit-template new file mode 100644 index 0000000..8a5c7cd --- /dev/null +++ b/docs/leap-commit-template @@ -0,0 +1,7 @@ +[bug|feat|docs|style|refactor|test|pkg|i18n] ... +... + +- Resolves: #XYZ +- Related: #XYZ +- Documentation: #XYZ +- Releases: XYZ diff --git a/docs/leap-commit-template.README b/docs/leap-commit-template.README new file mode 100644 index 0000000..ce8809e --- /dev/null +++ b/docs/leap-commit-template.README @@ -0,0 +1,47 @@ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +HOW TO USE THIS TEMPLATE: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Run `git config commit.template docs/leap-commit-template` or +edit the .git/config for this project and add +`template = docs/leap-commit-template` +under the [commit] block + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +COMMIT TEMPLATE FORMAT EXPLAINED +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +[type] + + +