summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <cheimes@redhat.com>2015-09-30 14:59:49 +0200
committerEndi S. Dewata <edewata@redhat.com>2016-04-02 00:24:23 +0200
commit0161505e61fc3460af7f9c13a0faed36d992721d (patch)
treea96112aa66c24449846d5d49343dfecff8997df3
parent5887e73c212da40f8bb36845acaf7840753e7684 (diff)
downloadpki-0161505e61fc3460af7f9c13a0faed36d992721d.tar.gz
pki-0161505e61fc3460af7f9c13a0faed36d992721d.tar.xz
pki-0161505e61fc3460af7f9c13a0faed36d992721d.zip
Python packaging of PKI client library
A new setup.py in base/common/python makes it possible to bundle the pki client library and upload it on PyPI. The setup.py in the root directory is only used for tox and testing. It's a cleaner and less fragile approach than to support two different build flavors with one setup.py The 'release' alias from setup.cfg creates and uploads a source distribution and an universal wheel: $ sudo yum install python-wheel python-setuptools $ cd base/common/python $ python setup.py release The 'packages' alias just creates the source distribution and wheel: $ python setup.py packages The version number is taken from the Version and Release fields of pki-core.spec.
-rw-r--r--.gitignore5
-rw-r--r--base/common/python/setup.cfg6
-rw-r--r--base/common/python/setup.py99
3 files changed, 110 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 172610bb1..2feeda176 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,8 @@ dist
MANIFEST
*.pyc
__pycache__
+
+/base/common/python/build/
+/base/common/python/dist/
+/base/common/python/dogtag_pki.egg-info/
+
diff --git a/base/common/python/setup.cfg b/base/common/python/setup.cfg
new file mode 100644
index 000000000..ad4348612
--- /dev/null
+++ b/base/common/python/setup.cfg
@@ -0,0 +1,6 @@
+[bdist_wheel]
+universal = 1
+
+[aliases]
+packages = clean --all egg_info bdist_wheel sdist --format=zip
+release = packages register upload
diff --git a/base/common/python/setup.py b/base/common/python/setup.py
new file mode 100644
index 000000000..16c1d1760
--- /dev/null
+++ b/base/common/python/setup.py
@@ -0,0 +1,99 @@
+# Authors:
+# Christian Heimes <cheimes@redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Copyright (C) 2015 Red Hat, Inc.
+# All rights reserved.
+#
+"""Dogtag client library
+
+In order to build wheels the wheel and setuptools packages are required:
+
+ $ sudo yum install python-wheel python-setuptools
+
+The 'release' alias builds and uploads a source distribution and universal
+wheel. The version and release number are taken from pki-core.spec file.
+
+ $ python setup.py release
+
+The 'packages' alias just creates the files locally:
+
+ $ python setup.py packages
+
+For a complete list of all available commands (except for aliases):
+
+ $python setup.py --help-commands
+"""
+
+import re
+try:
+ from setuptools import setup
+except ImportError:
+ from distutils.core import setup
+
+
+def get_version(specfile='../../../specs/pki-core.spec'):
+ version_re = re.compile('^Version:\s*(\d+\.\d+\.\d+)')
+ release_re = re.compile('^Release:.*?([\d\.]+)')
+ version = release = None
+ with open(specfile) as f:
+ for line in f:
+ if version is None:
+ match = version_re.match(line)
+ if match is not None:
+ version = match.group(1)
+ if release is None:
+ match = release_re.match(line)
+ if match is not None:
+ release = match.group(1)
+ if version is not None and release is not None:
+ break
+ if version is None or release is None:
+ raise ValueError(version, release)
+ return "%s.%s" % (version, release)
+
+VERSION = get_version()
+
+setup(
+ author='Dogtag Certificate System Team',
+ author_email='pki-devel@redhat.com',
+ name='dogtag-pki',
+ version=VERSION,
+ description='Client library for Dogtag Certificate System',
+ long_description="""\
+This package contains the REST client for Dogtag PKI.
+
+The Dogtag Certificate System is an enterprise-class open source
+Certificate Authority (CA). It is a full-featured system, and has been
+hardened by real-world deployments. It supports all aspects of certificate
+lifecycle management, including key archival, OCSP and smartcard management,
+and much more. The Dogtag Certificate System can be downloaded for free
+and set up in less than an hour.""",
+ license='GPL',
+ keywords='pki x509 cert certificate',
+ url='http://pki.fedoraproject.org/',
+ packages=['pki'],
+ requirements=['python-nss', 'requests', 'six'],
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: System Administrators',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3.4',
+ 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
+ 'Topic :: Security :: Cryptography',
+ ],
+)