Remove deprecated ebuilds cherrypy, progressbar, m2crypto

mhiretskiy
parent 2dd89f3c56
commit 918a43490d

@ -1 +0,0 @@
DIST CherryPy-3.8.0.tar.gz 433711 BLAKE2B e1b4a554138a61e8c6313c3055723583d812e573a352d67bd5448f799e4f2f22694b800810b53cd041c665e46d9555b471d1da91c252ade96459778d7a5c07fa SHA512 25f84093e30d814c0980f7d77b98492113470c3297c66ee8652e40650757f8e2b7db01bb8de6d7a1ea9b4bed8b764502b1f563ac6f0d082970bc2d46739d19c2

@ -1,51 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=5
PYTHON_COMPAT=( python{2_7,3_6} pypy3 )
inherit distutils-r1
MY_P="CherryPy-${PV}"
DESCRIPTION="CherryPy is a pythonic, object-oriented HTTP framework"
HOMEPAGE="https://www.cherrypy.org https://pypi.org/project/CherryPy/"
SRC_URI="mirror://pypi/C/CherryPy/${MY_P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 arm ia64 ppc x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos"
IUSE="test"
DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
test? ( >=dev-python/nose-1.3.3[${PYTHON_USEDEP}] )"
RDEPEND=""
S="${WORKDIR}/${MY_P}"
# testsuite predominantly connects to the network
RESTRICT="test"
python_prepare_all() {
# Prevent interactive failures (hangs) in the test suite
sed -i -e "s/interactive = True/interactive = False/" cherrypy/test/webtest.py || die
distutils-r1_python_prepare_all
}
python_test() {
# suite requires current latest nose-1.3.3
# https://bitbucket.org/cherrypy/cherrypy/issue/1308
# https://bitbucket.org/cherrypy/cherrypy/issue/1306
local exclude=(
-e test_file_stream -e test_4_File_deletion -e test_3_Redirect
-e test_2_File_Concurrency -e test_0_Session -e testStatic
)
# This really doesn't sit well with multiprocessing
# The issue 1306 tells us some tests are subject to the deleterious effects of
# the 'race condition'. Both the issues are unresolved / open
# if [[ "${EPYTHON}" == pypy ]]; then
nosetests "${exclude[@]}" -I test_logging.py || die "Testing failed with ${EPYTHON}"
# else
# nosetests "${exclude[@]}" < /dev/tty || die "Testing failed with ${EPYTHON}"
# fi
}

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<upstream>
<remote-id type="pypi">CherryPy</remote-id>
</upstream>
</pkgmetadata>

@ -1,10 +0,0 @@
# ChangeLog for dev-python/m2crypto
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
# $Header: $
*m2crypto-0.21.1 (23 May 2012)
23 May 2012; Mike Hiretsky (mhiretskiy) <mh@calculate.ru>
+m2crypto-0.21.1.ebuild, +metadata.xml:
Copy from portage

@ -1,2 +0,0 @@
DIST M2Crypto-0.22.3.tar.gz 74795 SHA256 6071bfc817d94723e9b458a010d565365104f84aa73f7fe11919871f7562ff72 SHA512 c179d3cf03ced77aed24285ca3f1527d5e05bbfe091a1522bff94a940fd390213fbb9b83d7ccd43ceae49626b427ae8790782cf93ead85be1e063bc4121c62e0 WHIRLPOOL 66a9a6e7c9b195814048a1bcecf6ef71a269bebb9dbda73801c88b3ba27330b555a46d05c53bbd0778f9c1e1bb5f9c6e7e860de443bf16baffc2072ee5996e31
DIST M2Crypto-0.24.0.tar.gz 184457 SHA256 80a56441a1d2c0cf27e725be7554c92598b938fc8767ee2c71fdbc2fdc055ee8 SHA512 c23ae0f8ac790d4ef108a217a44e994341f6bbe4e12a7fef2518d8def82331246a145e19a2504b82b790a3ad4b467d2facc8a73bb7f1190b56441d8482c66aca WHIRLPOOL 47a437ee1207b4cca8d67aa4bdec95b9194030e3fc7146ace8d071caa9be829f3e9516ff9399e695615acdf930a90040deb0f1175d81994465ed0853688e3b37

@ -1,138 +0,0 @@
From 803188070e486030cb1d2e53692b39305c742b17 Mon Sep 17 00:00:00 2001
From: Joe Julian <jjulian@io.com>
Date: Tue, 19 May 2015 23:54:08 -0700
Subject: [PATCH] Use swig generated python loader
---
.gitignore | 6 +++++-
M2Crypto/__init__.py | 4 ++--
M2Crypto/m2.py | 4 +---
SWIG/_m2crypto.def | 2 +-
SWIG/_m2crypto.i | 2 +-
setup.py | 25 +++++++++++++++++++++----
6 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/M2Crypto/__init__.py b/M2Crypto/__init__.py
index 647e057..38dbbd5 100644
--- a/M2Crypto/__init__.py
+++ b/M2Crypto/__init__.py
@@ -19,7 +19,7 @@ Copyright 2008-2011 Heikki Toivonen. All rights reserved.
version_info = (0, 22)
version = '.'.join([str(_v) for _v in version_info])
-import __m2crypto
+import m2crypto
import m2
import ASN1
import AuthCookie
@@ -47,4 +47,4 @@ import m2xmlrpclib
import threading
import util
-__m2crypto.lib_init()
+m2crypto.lib_init()
diff --git a/M2Crypto/m2.py b/M2Crypto/m2.py
index e4bb695..516cadb 100644
--- a/M2Crypto/m2.py
+++ b/M2Crypto/m2.py
@@ -25,7 +25,5 @@ Portions created by Open Source Applications Foundation (OSAF) are
Copyright (C) 2004 OSAF. All Rights Reserved.
"""
-from __m2crypto import *
+from m2crypto import *
lib_init()
-
-
diff --git a/SWIG/_m2crypto.def b/SWIG/_m2crypto.def
index 753db2c..3e9d5bc 100644
--- a/SWIG/_m2crypto.def
+++ b/SWIG/_m2crypto.def
@@ -1,2 +1,2 @@
EXPORTS
-init__m2crypto
+init_m2crypto
diff --git a/SWIG/_m2crypto.i b/SWIG/_m2crypto.i
index 50be5c3..e491222 100644
--- a/SWIG/_m2crypto.i
+++ b/SWIG/_m2crypto.i
@@ -8,7 +8,7 @@
*
*/
-%module(threads=1) _m2crypto
+%module(threads=1) m2crypto
/* We really don't need threadblock (PyGILState_Ensure() etc.) anywhere.
Disable threadallow as well, only enable it for operations likely to
block. */
diff --git a/setup.py b/setup.py
index bac6f9f..fc89513 100644
--- a/setup.py
+++ b/setup.py
@@ -17,9 +17,22 @@ import os, sys, platform
from setuptools import setup
from setuptools.command import build_ext
+from distutils.util import get_platform
from distutils.core import Extension
from distutils.spawn import find_executable
+from distutils.command.build import build
+from setuptools.command.install import install
+
+class CustomBuild(build):
+ def run(self):
+ self.run_command('build_ext')
+ build.run(self)
+
+class CustomInstall(install):
+ def run(self):
+ self.run_command('build_ext')
+ self.do_egg_install()
class _M2CryptoBuildExt(build_ext.build_ext):
'''Specialization of build_ext to enable swig_opts to inherit any
@@ -70,11 +83,12 @@ class _M2CryptoBuildExt(build_ext.build_ext):
self.add_multiarch_paths()
- opensslIncludeDir = os.path.join(self.openssl, 'include')
+ includeDir = os.path.join(self.openssl, 'include')
+ opensslIncludeDir = os.path.join(self.openssl, 'include', 'openssl')
opensslLibraryDir = os.path.join(self.openssl, 'lib')
self.swig_opts = ['-I%s' % i for i in self.include_dirs + \
- [opensslIncludeDir, os.path.join(opensslIncludeDir, "openssl")]]
+ [opensslIncludeDir, includeDir]]
self.swig_opts.append('-includeall')
self.swig_opts.append('-modern')
@@ -85,6 +99,9 @@ class _M2CryptoBuildExt(build_ext.build_ext):
elif platform.architecture()[0] == '32bit':
self.swig_opts.append('-D__i386__')
+ self.swig_opts.append('-outdir')
+ self.swig_opts.append(os.path.join(os.getcwd(),'M2Crypto'))
+
self.include_dirs += [os.path.join(self.openssl, opensslIncludeDir),
os.path.join(os.getcwd(), 'SWIG')]
@@ -103,7 +120,7 @@ if sys.platform == 'darwin':
else:
my_extra_compile_args = []
-m2crypto = Extension(name = 'M2Crypto.__m2crypto',
+m2crypto = Extension(name = 'M2Crypto._m2crypto',
sources = ['SWIG/_m2crypto.i'],
extra_compile_args = ['-DTHREADING'] + my_extra_compile_args,
#extra_link_args = ['-Wl,-search_paths_first'], # Uncomment to build Universal Mac binaries
@@ -145,5 +162,5 @@ interface.''',
ext_modules = [m2crypto],
test_suite='tests.alltests.suite',
- cmdclass = {'build_ext': _M2CryptoBuildExt}
+ cmdclass = {'build': CustomBuild, 'install': CustomInstall, 'build_ext': _M2CryptoBuildExt}
)
--
2.4.1

@ -1,69 +0,0 @@
From 0f2c82f097cf6d3722b7793fe1159160f3f52725 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Mon, 25 May 2015 12:08:47 -0400
Subject: [PATCH] Gentoo-specific packaging fixes
Fix cross-compiles
EPREFIX support
---
setup.py | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/setup.py b/setup.py
index fc89513..8360e7e 100644
--- a/setup.py
+++ b/setup.py
@@ -32,7 +32,7 @@ class CustomBuild(build):
class CustomInstall(install):
def run(self):
self.run_command('build_ext')
- self.do_egg_install()
+ install.run(self)
class _M2CryptoBuildExt(build_ext.build_ext):
'''Specialization of build_ext to enable swig_opts to inherit any
@@ -81,29 +81,19 @@ class _M2CryptoBuildExt(build_ext.build_ext):
build_ext.build_ext.finalize_options(self)
- self.add_multiarch_paths()
-
includeDir = os.path.join(self.openssl, 'include')
opensslIncludeDir = os.path.join(self.openssl, 'include', 'openssl')
opensslLibraryDir = os.path.join(self.openssl, 'lib')
- self.swig_opts = ['-I%s' % i for i in self.include_dirs + \
- [opensslIncludeDir, includeDir]]
+ eprefix = os.getenv('EPREFIX', '')
+ self.swig_opts = ['-I' + eprefix + '/usr/include']
self.swig_opts.append('-includeall')
self.swig_opts.append('-modern')
- # Fedora does hat tricks.
- if platform.linux_distribution()[0] in ['Fedora', 'CentOS']:
- if platform.architecture()[0] == '64bit':
- self.swig_opts.append('-D__x86_64__')
- elif platform.architecture()[0] == '32bit':
- self.swig_opts.append('-D__i386__')
-
self.swig_opts.append('-outdir')
self.swig_opts.append(os.path.join(os.getcwd(),'M2Crypto'))
- self.include_dirs += [os.path.join(self.openssl, opensslIncludeDir),
- os.path.join(os.getcwd(), 'SWIG')]
+ self.include_dirs += [os.path.join(os.getcwd(), 'SWIG')]
if sys.platform == 'cygwin':
# Cygwin SHOULD work (there's code in distutils), but
@@ -113,8 +103,6 @@ class _M2CryptoBuildExt(build_ext.build_ext):
# Someday distutils will be fixed and this won't be needed.
self.library_dirs += [os.path.join(self.openssl, 'bin')]
- self.library_dirs += [os.path.join(self.openssl, opensslLibraryDir)]
-
if sys.platform == 'darwin':
my_extra_compile_args = ["-Wno-deprecated-declarations"]
else:
--
2.4.1

@ -1,245 +0,0 @@
diff --git M2Crypto/X509.py M2Crypto/X509.py
index 62096f3..500f740 100644
--- M2Crypto/X509.py
+++ M2Crypto/X509.py
@@ -29,9 +29,11 @@ def new_extension(name, value, critical=0, _pyfree=1):
"""
Create new X509_Extension instance.
"""
- if name == 'subjectKeyIdentifier' and \
- value.strip('0123456789abcdefABCDEF:') is not '':
- raise ValueError('value must be precomputed hash')
+ if X509_Extension_Proxy.must_proxy(name, value):
+ # Maybe all extensions should be proxies?
+ # XXX Either all proxies (might solve other problems too), or at
+ # XXX least at least need to refactor to avoid code duplication
+ return X509_Extension_Proxy(name, value, critical, _pyfree)
lhash = m2.x509v3_lhash()
ctx = m2.x509v3_set_conf_lhash(lhash)
x509_ext_ptr = m2.x509v3_ext_conf(lhash, ctx, name, value)
@@ -40,6 +42,96 @@ def new_extension(name, value, critical=0, _pyfree=1):
return x509_ext
+class X509_Extension_Proxy:
+ """
+ A holder object for X509 Extensions that need to be created with
+ certificate based calculated values.
+ """
+ def __init__ (self, name, value, critical=0, _pyfree=1):
+ self.name = name
+ self.value = value
+ self.critical = critical
+ self._pyfree = _pyfree
+
+ @staticmethod
+ def must_proxy (name, value):
+ """
+ Checks if this extension name and value define a calculated extension,
+ i.e. one that needs the certificate to render a valid value.
+ """
+ # XXX Are these the only cases where we must proxy?
+ # XXX Even if they are now, it does not seem this is future proof...
+ # XXX any other way around this?
+ return (name == 'subjectKeyIdentifier' and value == 'hash') or \
+ (name == 'authorityKeyIdentifier')
+
+ def set_critical(self, critical=1):
+ """
+ Mark this extension critical or noncritical. By default an
+ extension is not critical.
+
+ @type critical: int
+ @param critical: Nonzero sets this extension as critical.
+ Calling this method without arguments will
+ set this extension to critical.
+ """
+ self.critical = critical
+ return self.critical
+
+ def get_critical(self):
+ """
+ Return whether or not this is a critical extension.
+
+ @rtype: int
+ @return: Nonzero if this is a critical extension.
+ """
+ return self.critical
+
+ def get_name(self):
+ """
+ Get the extension name, for example 'subjectAltName'.
+ """
+ return self.name
+
+ def get_value(self, flag=0, indent=0):
+ """
+ Get the extension value, for example 'DNS:www.example.com'.
+
+ @param flag: Flag to control what and how to print.
+ Ignored in this proxy.
+ @param indent: How many spaces to print before actual value.
+ """
+ # XXX It is a problem that this method can give different output
+ # XXX compared to the real object.
+ return (" " * indent) + self.value
+
+ def __call__ (self, cert=None):
+ """
+ Create new X509_Extension instance.
+ """
+ # XXX Why is this __call__, wouldn't it be clearer to have an explicit
+ # XXX name for this? Or is there some usage I am missing...?
+ lhash = m2.x509v3_lhash()
+ ctx = m2.x509v3_set_conf_lhash(lhash)
+ if cert:
+ if isinstance(cert, X509) and m2.x509_type_check(cert.x509):
+ m2.x509v3_set_ctx_subject(ctx, cert.x509)
+ if cert.issuer and m2.x509_type_check(cert.issuer.x509):
+ m2.x509v3_set_ctx_issuer(ctx, cert.issuer.x509)
+ else:
+ m2.x509v3_set_ctx_issuer(ctx, cert.x509)
+ elif isinstance(cert, Request) and cert.req:
+ m2.x509v3_set_ctx_request(ctx, cert.req)
+ else:
+ if self.name == 'subjectKeyIdentifier' and self.value == 'hash':
+ raise ValueError('value must be precomputed hash if no context is given')
+
+ x509_ext_ptr = m2.x509v3_ext_conf(lhash, ctx, self.name, self.value)
+ x509_ext = X509_Extension(x509_ext_ptr, self._pyfree)
+ x509_ext.set_critical(self.critical)
+ return x509_ext
+
+
class X509_Extension: # noqa
"""
X509 Extension
@@ -123,6 +215,7 @@ class X509_Extension_Stack: # noqa
self.stack = m2.sk_x509_extension_new_null()
self._pyfree = 1
self.pystack = [] # This must be kept in sync with self.stack
+ self.proxies = []
def __del__(self):
if getattr(self, '_pyfree', 0):
@@ -149,6 +242,9 @@ class X509_Extension_Stack: # noqa
@param x509_ext: X509_Extension object to be pushed onto the stack.
@return: The number of extensions on the stack.
"""
+ if isinstance(x509_ext, X509_Extension_Proxy):
+ self.proxies.append(x509_ext)
+ return len(self.proxies)
self.pystack.append(x509_ext)
ret = m2.sk_x509_extension_push(self.stack, x509_ext._ptr())
assert ret == len(self.pystack)
@@ -166,6 +262,14 @@ class X509_Extension_Stack: # noqa
return None
return self.pystack.pop()
+ def process_proxies(self, cert):
+ """
+ Create extensions from stored proxies, now that we have a context to work with.
+ """
+ for p in self.proxies:
+ self.push(p(cert))
+ self.proxies = []
+
class X509_Name_Entry: # noqa
"""
@@ -350,6 +454,7 @@ class X509:
else:
self.x509 = m2.x509_new()
self._pyfree = 1
+ self.issuer = None
def __del__(self):
if getattr(self, '_pyfree', 0):
@@ -488,15 +593,18 @@ class X509:
assert m2.x509_type_check(self.x509), "'x509' type error"
return X509_Name(m2.x509_get_issuer_name(self.x509))
- def set_issuer(self, name):
+ def set_issuer(self, issuer):
"""
- Set issuer name.
+ Set issuer object (and set issuer name). The object will be used in extension contexts if needed.
- @type name: X509_Name
- @param name: subjectName field.
+ @type name: X509_Name or X509
+ @param name: subjectName field or issuer object.
"""
assert m2.x509_type_check(self.x509), "'x509' type error"
- return m2.x509_set_issuer_name(self.x509, name.x509_name)
+ if isinstance(issuer, X509):
+ self.issuer = issuer
+ issuer = X509_Name(m2.x509_get_subject_name(issuer.x509))
+ return m2.x509_set_issuer_name(self.x509, issuer.x509_name)
def get_subject(self):
assert m2.x509_type_check(self.x509), "'x509' type error"
@@ -519,6 +627,9 @@ class X509:
@type ext: X509_Extension
@param ext: Extension
"""
+ if isinstance(ext, X509_Extension_Proxy):
+ ext = ext(self)
+
assert m2.x509_type_check(self.x509), "'x509' type error"
return m2.x509_add_ext(self.x509, ext.x509_ext, -1)
@@ -1003,6 +1114,7 @@ class Request:
@type ext_stack: X509_Extension_Stack
@param ext_stack: Stack of extensions to add.
"""
+ ext_stack.process_proxies(self)
return m2.x509_req_add_extensions(self.req, ext_stack._ptr())
def verify(self, pkey):
diff --git SWIG/_x509.i SWIG/_x509.i
index be3099a..0ab1c78 100644
--- SWIG/_x509.i
+++ SWIG/_x509.i
@@ -531,6 +531,10 @@ x509v3_set_conf_lhash(LHASH * lhash) {
PyErr_SetString(PyExc_MemoryError, "x509v3_set_conf_lhash");
return NULL;
}
+ /* XXX Why is this needed? */
+ /* Make sure the structure members are nulled */
+ X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, 0);
+
X509V3_set_conf_lhash(ctx, lhash);
return ctx;
}
@@ -659,6 +663,30 @@ get_der_encoding_stack(STACK_OF(X509) *stack){
return encodedString;
}
+/* XXX Are these simple pointers in the context, or should they be refcounted? */
+
+/* XXX Since these are really only used in one method, should these instead be
+ * XXX made into a single function, which can be called with NULL for
+ * XXX optional fields? Otherwise, what is there stopping calling
+ * XXX set_ctx_subject without having set ctx first? */
+
+void x509v3_set_ctx_issuer(X509V3_CTX *ctx, X509 *issuer) {
+ ctx->issuer_cert = issuer;
+}
+
+void x509v3_set_ctx_subject(X509V3_CTX *ctx, X509 *subject) {
+ ctx->subject_cert = subject;
+}
+
+void x509v3_set_ctx_request(X509V3_CTX *ctx, X509_REQ *request) {
+ ctx->subject_req = request;
+}
+
+/* XXX This does not seem to be used, why is it here? */
+void x509v3_set_ctx_crl(X509V3_CTX *ctx, X509_CRL *crl) {
+ ctx->crl = crl;
+}
+
%}
/* Free malloc'ed return value for x509_name_oneline */

@ -1,244 +0,0 @@
diff --git a/M2Crypto/X509.py b/M2Crypto/X509.py
index eef83fe..f64289e 100644
--- a/M2Crypto/X509.py
+++ b/M2Crypto/X509.py
@@ -24,9 +24,11 @@ def new_extension(name, value, critical=0, _pyfree=1):
"""
Create new X509_Extension instance.
"""
- if name == 'subjectKeyIdentifier' and \
- value.strip('0123456789abcdefABCDEF:') is not '':
- raise ValueError('value must be precomputed hash')
+ if X509_Extension_Proxy.must_proxy(name, value):
+ # Maybe all extensions should be proxies?
+ # XXX Either all proxies (might solve other problems too), or at
+ # XXX least at least need to refactor to avoid code duplication
+ return X509_Extension_Proxy(name, value, critical, _pyfree)
lhash = m2.x509v3_lhash()
ctx = m2.x509v3_set_conf_lhash(lhash)
x509_ext_ptr = m2.x509v3_ext_conf(lhash, ctx, name, value)
@@ -35,6 +37,96 @@ def new_extension(name, value, critical=0, _pyfree=1):
return x509_ext
+class X509_Extension_Proxy:
+ """
+ A holder object for X509 Extensions that need to be created with
+ certificate based calculated values.
+ """
+ def __init__ (self, name, value, critical=0, _pyfree=1):
+ self.name = name
+ self.value = value
+ self.critical = critical
+ self._pyfree = _pyfree
+
+ @staticmethod
+ def must_proxy (name, value):
+ """
+ Checks if this extension name and value define a calculated extension,
+ i.e. one that needs the certificate to render a valid value.
+ """
+ # XXX Are these the only cases where we must proxy?
+ # XXX Even if they are now, it does not seem this is future proof...
+ # XXX any other way around this?
+ return (name == 'subjectKeyIdentifier' and value == 'hash') or \
+ (name == 'authorityKeyIdentifier')
+
+ def set_critical(self, critical=1):
+ """
+ Mark this extension critical or noncritical. By default an
+ extension is not critical.
+
+ @type critical: int
+ @param critical: Nonzero sets this extension as critical.
+ Calling this method without arguments will
+ set this extension to critical.
+ """
+ self.critical = critical
+ return self.critical
+
+ def get_critical(self):
+ """
+ Return whether or not this is a critical extension.
+
+ @rtype: int
+ @return: Nonzero if this is a critical extension.
+ """
+ return self.critical
+
+ def get_name(self):
+ """
+ Get the extension name, for example 'subjectAltName'.
+ """
+ return self.name
+
+ def get_value(self, flag=0, indent=0):
+ """
+ Get the extension value, for example 'DNS:www.example.com'.
+
+ @param flag: Flag to control what and how to print.
+ Ignored in this proxy.
+ @param indent: How many spaces to print before actual value.
+ """
+ # XXX It is a problem that this method can give different output
+ # XXX compared to the real object.
+ return (" " * indent) + self.value
+
+ def __call__ (self, cert=None):
+ """
+ Create new X509_Extension instance.
+ """
+ # XXX Why is this __call__, wouldn't it be clearer to have an explicit
+ # XXX name for this? Or is there some usage I am missing...?
+ lhash = m2.x509v3_lhash()
+ ctx = m2.x509v3_set_conf_lhash(lhash)
+ if cert:
+ if isinstance(cert, X509) and m2.x509_type_check(cert.x509):
+ m2.x509v3_set_ctx_subject(ctx, cert.x509)
+ if cert.issuer and m2.x509_type_check(cert.issuer.x509):
+ m2.x509v3_set_ctx_issuer(ctx, cert.issuer.x509)
+ else:
+ m2.x509v3_set_ctx_issuer(ctx, cert.x509)
+ elif isinstance(cert, Request) and cert.req:
+ m2.x509v3_set_ctx_request(ctx, cert.req)
+ else:
+ if self.name == 'subjectKeyIdentifier' and self.value == 'hash':
+ raise ValueError('value must be precomputed hash if no context is given')
+
+ x509_ext_ptr = m2.x509v3_ext_conf(lhash, ctx, self.name, self.value)
+ x509_ext = X509_Extension(x509_ext_ptr, self._pyfree)
+ x509_ext.set_critical(self.critical)
+ return x509_ext
+
+
class X509_Extension:
"""
X509 Extension
@@ -117,6 +209,7 @@ class X509_Extension_Stack:
self.stack = m2.sk_x509_extension_new_null()
self._pyfree = 1
self.pystack = [] # This must be kept in sync with self.stack
+ self.proxies = []
def __del__(self):
if getattr(self, '_pyfree', 0):
@@ -143,6 +236,9 @@ class X509_Extension_Stack:
@param x509_ext: X509_Extension object to be pushed onto the stack.
@return: The number of extensions on the stack.
"""
+ if isinstance(x509_ext, X509_Extension_Proxy):
+ self.proxies.append(x509_ext)
+ return len(self.proxies)
self.pystack.append(x509_ext)
ret = m2.sk_x509_extension_push(self.stack, x509_ext._ptr())
assert ret == len(self.pystack)
@@ -160,6 +256,13 @@ class X509_Extension_Stack:
return None
return self.pystack.pop()
+ def process_proxies(self, cert):
+ """
+ Create extensions from stored proxies, now that we have a context to work with.
+ """
+ for p in self.proxies:
+ self.push(p(cert))
+ self.proxies = []
class X509_Name_Entry:
"""
@@ -333,6 +436,7 @@ class X509:
else:
self.x509 = m2.x509_new ()
self._pyfree = 1
+ self.issuer = None
def __del__(self):
if getattr(self, '_pyfree', 0):
@@ -464,15 +568,18 @@ class X509:
assert m2.x509_type_check(self.x509), "'x509' type error"
return X509_Name(m2.x509_get_issuer_name(self.x509))
- def set_issuer(self, name):
+ def set_issuer(self, issuer):
"""
- Set issuer name.
+ Set issuer object (and set issuer name). The object will be used in extension contexts if needed.
- @type name: X509_Name
- @param name: subjectName field.
+ @type name: X509_Name or X509
+ @param name: subjectName field or issuer object.
"""
assert m2.x509_type_check(self.x509), "'x509' type error"
- return m2.x509_set_issuer_name(self.x509, name.x509_name)
+ if isinstance(issuer, X509):
+ self.issuer = issuer
+ issuer = X509_Name(m2.x509_get_subject_name(issuer.x509))
+ return m2.x509_set_issuer_name(self.x509, issuer.x509_name)
def get_subject(self):
assert m2.x509_type_check(self.x509), "'x509' type error"
@@ -495,6 +602,9 @@ class X509:
@type ext: X509_Extension
@param ext: Extension
"""
+ if isinstance(ext, X509_Extension_Proxy):
+ ext = ext(self)
+
assert m2.x509_type_check(self.x509), "'x509' type error"
return m2.x509_add_ext(self.x509, ext.x509_ext, -1)
@@ -966,6 +1076,7 @@ class Request:
@type ext_stack: X509_Extension_Stack
@param ext_stack: Stack of extensions to add.
"""
+ ext_stack.process_proxies(self)
return m2.x509_req_add_extensions(self.req, ext_stack._ptr())
def verify(self, pkey):
diff --git a/SWIG/_x509.i b/SWIG/_x509.i
index 0471f68..a1a5212 100644
--- a/SWIG/_x509.i
+++ b/SWIG/_x509.i
@@ -531,6 +531,10 @@ x509v3_set_conf_lhash(LHASH * lhash) {
PyErr_SetString(PyExc_MemoryError, "x509v3_set_conf_lhash");
return NULL;
}
+ /* XXX Why is this needed? */
+ /* Make sure the structure members are nulled */
+ X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, 0);
+
X509V3_set_conf_lhash(ctx, lhash);
return ctx;
}
@@ -659,6 +663,30 @@ get_der_encoding_stack(STACK_OF(X509) *stack){
return encodedString;
}
+/* XXX Are these simple pointers in the context, or should they be refcounted? */
+
+/* XXX Since these are really only used in one method, should these instead be
+ * XXX made into a single function, which can be called with NULL for
+ * XXX optional fields? Otherwise, what is there stopping calling
+ * XXX set_ctx_subject without having set ctx first? */
+
+void x509v3_set_ctx_issuer(X509V3_CTX *ctx, X509 *issuer) {
+ ctx->issuer_cert = issuer;
+}
+
+void x509v3_set_ctx_subject(X509V3_CTX *ctx, X509 *subject) {
+ ctx->subject_cert = subject;
+}
+
+void x509v3_set_ctx_request(X509V3_CTX *ctx, X509_REQ *request) {
+ ctx->subject_req = request;
+}
+
+/* XXX This does not seem to be used, why is it here? */
+void x509v3_set_ctx_crl(X509V3_CTX *ctx, X509_CRL *crl) {
+ ctx->crl = crl;
+}
+
%}
/* Free malloc'ed return value for x509_name_oneline */

@ -1,42 +0,0 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=5
PYTHON_COMPAT=( python2_7 )
PYTHON_REQ_USE="threads(+)"
inherit distutils-r1
MY_PN="M2Crypto"
DESCRIPTION="M2Crypto: A Python crypto and SSL toolkit"
HOMEPAGE="https://github.com/martinpaljak/M2Crypto https://pypi.python.org/pypi/M2Crypto"
SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_PN}-${PV}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
IUSE=""
RDEPEND=">=dev-libs/openssl-0.9.8:0="
DEPEND="${RDEPEND}
>=dev-lang/swig-1.3.28:0
dev-python/setuptools[${PYTHON_USEDEP}]
"
S="${WORKDIR}/${MY_PN}-${PV}"
# Tests access network, and fail randomly. Bug #431458.
RESTRICT=test
PATCHES=(
"${FILESDIR}"/0.22.3-Use-swig-generated-python-loader.patch
"${FILESDIR}"/0.22.3-packaging.patch
"${FILESDIR}"/m2crypto-extension-work.patch
)
python_test() {
esetup.py test
}

@ -1,43 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=5
PYTHON_COMPAT=( python2_7 )
PYTHON_REQ_USE="threads(+)"
inherit distutils-r1
MY_PN="M2Crypto"
DESCRIPTION="M2Crypto: A Python crypto and SSL toolkit"
HOMEPAGE="https://gitlab.com/m2crypto/m2crypto https://pypi.python.org/pypi/M2Crypto"
SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_PN}-${PV}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="alpha amd64 ~arm ~arm64 hppa ~ia64 ~mips ~ppc ppc64 ~s390 ~sh ~sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
IUSE="libressl"
RDEPEND="
!libressl? ( >=dev-libs/openssl-0.9.8:0= )
libressl? ( dev-libs/libressl:= )
"
DEPEND="${RDEPEND}
>=dev-lang/swig-1.3.28:0
dev-python/setuptools[${PYTHON_USEDEP}]
"
S="${WORKDIR}/${MY_PN}-${PV}"
# Tests access network, and fail randomly. Bug #431458.
RESTRICT=test
PATCHES=(
"${FILESDIR}"/m2crypto-extension-work-0.24.0.patch
)
python_test() {
esetup.py test
}

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>python</herd>
<upstream>
<remote-id type="pypi">M2Crypto</remote-id>
</upstream>
</pkgmetadata>

@ -1 +1 @@
DIST nodeenv-1.3.3.tar.gz 34015 BLAKE2B bea91ad8b095c6b9d3cb670ce1552f3b03d7a16e1c1fb681bb55c8b7173cc6bd1a1e0edcbb60c052a9aa6e6454847542f41d19e4c2a5e427aa9be255b8380029 SHA512 4ed6084d83c28beccd5e4326d122ac4d84b70c3107fd3569ce85d6a2927abfc10c792150f01ac46aae7941899d91b3048dfa069421b805a43fa83427a62380ba
DIST nodeenv-1.3.5.tar.gz 32824 BLAKE2B 4f9e2c14562ff9c396142c5980876a97103d9206f796e9d9d1f67f29819a04db0e8ed232eb3f841a1e2efde84e55d6d7213082f6be568d7a6291562c5624a9dc SHA512 c7e9068a220f183a217b15e724aa8197fca8f2234c76eafd230899963b6796e66e151c20c529e6540f7e3c59849bda3860d563b38f5feeff73601043f79cfba0

@ -1 +0,0 @@
DIST progressbar-2.3.tar.gz 9420 BLAKE2B 025f2d42fb0ef11a2e4b974ba6a8cd44c48a7f828ec40a08347492d393acac46fa9c29962d39fe296af655e94ab2075885c73ed6953e2d739aeb6f5f0c0aa13f SHA512 06fdc8b6664642bd864be8023355316fba23bcc4deb0c5877c5dfa91da5d233301a8f39342f133cbb63f37a20de7b8b24910ac8073127fcbdf43b5200d60ed5f

@ -1,94 +0,0 @@
# HG changeset patch
# User Nilton Volpato <nilton@google.com>
# Date 1348267873 10800
# Fri Sep 21 19:51:13 2012 -0300
# Node ID 3c94a3a1ebe1325c7c605cc8f11126dcc632b04d
# Parent 83ece680e4fe06aa704de4c3a967355db21046d4
Remove format as a slot attribute, as that is not compatible with python 3.3
diff --git a/progressbar/widgets.py b/progressbar/widgets.py
--- a/progressbar/widgets.py
+++ b/progressbar/widgets.py
@@ -81,11 +81,11 @@
class Timer(Widget):
"""Widget which displays the elapsed seconds."""
- __slots__ = ('format',)
+ __slots__ = ('format_string',)
TIME_SENSITIVE = True
def __init__(self, format='Elapsed Time: %s'):
- self.format = format
+ self.format_string = format
@staticmethod
def format_time(seconds):
@@ -97,7 +97,7 @@
def update(self, pbar):
"""Updates the widget to show the elapsed time."""
- return self.format % self.format_time(pbar.seconds_elapsed)
+ return self.format_string % self.format_time(pbar.seconds_elapsed)
class ETA(Timer):
@@ -121,9 +121,9 @@
class FileTransferSpeed(Widget):
"""Widget for showing the transfer speed (useful for file transfers)."""
- format = '%6.2f %s%s/s'
- prefixes = ' kMGTPEZY'
- __slots__ = ('unit', 'format')
+ FORMAT = '%6.2f %s%s/s'
+ PREFIXES = ' kMGTPEZY'
+ __slots__ = ('unit',)
def __init__(self, unit='B'):
self.unit = unit
@@ -138,7 +138,7 @@
power = int(math.log(speed, 1000))
scaled = speed / 1000.**power
- return self.format % (scaled, self.prefixes[power], self.unit)
+ return self.FORMAT % (scaled, self.PREFIXES[power], self.unit)
class AnimatedMarker(Widget):
@@ -168,13 +168,13 @@
class Counter(Widget):
"""Displays the current count."""
- __slots__ = ('format',)
+ __slots__ = ('format_string',)
def __init__(self, format='%d'):
- self.format = format
+ self.format_string = format
def update(self, pbar):
- return self.format % pbar.currval
+ return self.format_string % pbar.currval
class Percentage(Widget):
@@ -197,9 +197,9 @@
'value': ('currval', None)
}
- __slots__ = ('format',)
+ __slots__ = ('format_string',)
def __init__(self, format):
- self.format = format
+ self.format_string = format
def update(self, pbar):
context = {}
@@ -213,7 +213,7 @@
context[name] = transform(value)
except: pass
- return self.format % context
+ return self.format_string % context
class SimpleProgress(Widget):

@ -1,21 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=5
PYTHON_COMPAT=( python2_7 python3_6 pypy3)
inherit distutils-r1
DESCRIPTION="Text progressbar library for python"
HOMEPAGE="https://pypi.org/project/progressbar/"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
LICENSE="|| ( LGPL-2.1 BSD )"
SLOT="0"
KEYWORDS="amd64 ~arm ppc x86 ~amd64-linux ~x86-linux"
IUSE=""
DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]"
RDEPEND=""
PATCHES=( "${FILESDIR}/progressbar-2.3-python3.3.patch" )
Loading…
Cancel
Save