summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorChristian Heimes <cheimes@redhat.com>2015-07-01 13:15:30 +0200
committerChristian Heimes <cheimes@redhat.com>2015-07-10 10:35:54 +0200
commit597bf54f3e999867a3e42686b3063b169b52018c (patch)
tree30556ee484a2ff3eb931c92d0f0fad130f35aa72 /setup.py
parentfa302897b3e97d78b925e8ee763c822a1169f07a (diff)
downloadpki-597bf54f3e999867a3e42686b3063b169b52018c.tar.gz
pki-597bf54f3e999867a3e42686b3063b169b52018c.tar.xz
pki-597bf54f3e999867a3e42686b3063b169b52018c.zip
In-tree tests and linting with tox
Before the patch it wasn't possible to run pylint outside a RPM build. The Python sources were split into common and server files in two separate trees. With setup.py and tox the pki package can now be installed and tested in a virtual env. Tox enables developers to automate installation and testing in Python virtual environment. The new tox.ini performs several tasks with one command: * It creates and installs a source distribution of pki packages and its command line scripts * It verifies that all CLI scripts can be execute (using its --help argument). * It runs pylint on all Python files and CLI scripts. * It can run flake8 on all Python and CLI files (disabled for now). * Finally it builds Sphinx autodocs. I had to delay the root check in pkispawn and pkidestroy and modify two files to get rid of Sphinx warnings. https://fedorahosted.org/pki/ticket/696 http://tox.readthedocs.org
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py80
1 files changed, 80 insertions, 0 deletions
diff --git a/setup.py b/setup.py
new file mode 100644
index 000000000..0d760c0ee
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,80 @@
+# 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.
+#
+
+import os
+from fnmatch import fnmatch
+from distutils.core import setup
+
+
+def find_upgrade(origroot, destroot):
+ upgrades = {}
+ for dirpath, dirnames, filenames in os.walk(origroot):
+ for filename in filenames:
+ if fnmatch(filename, '[0-9][0-9]-*'):
+ version = os.path.basename(dirpath)
+ orig = os.path.join(dirpath, filename)
+ dest = os.path.join(destroot, version)
+ upgrades.setdefault(dest, []).append(orig)
+ return upgrades
+
+upgrades = {}
+upgrades.update(find_upgrade('base/common/upgrade',
+ 'share/pki/upgrade'))
+upgrades.update(find_upgrade('base/server/upgrade',
+ 'share/pki/server/upgrade'))
+
+setup(
+ author='Dogtag Certificate System Team',
+ author_email='pki-devel@redhat.com',
+ name='Dogtag PKI',
+ version='10',
+ description='Dogtag Certificate System',
+ license='GPL',
+ keywords='pki',
+ url='http://pki.fedoraproject.org/',
+ package_dir={
+ 'pki': 'base/common/python/pki',
+ 'pki.server': 'base/server/python/pki/server'
+ },
+ packages=[
+ 'pki',
+ 'pki.server',
+ 'pki.server.cli',
+ 'pki.server.deployment',
+ 'pki.server.deployment.scriptlets',
+ ],
+ scripts=[
+ 'base/common/sbin/pki-upgrade',
+ 'base/server/sbin/pkidestroy',
+ 'base/server/sbin/pki-server',
+ 'base/server/sbin/pki-server-upgrade',
+ 'base/server/sbin/pkispawn',
+ 'base/java-tools/bin/pki',
+ ],
+ data_files=upgrades.items(),
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: System Administrators',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python :: 2.7',
+ 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
+ ],
+)