[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Pki-devel] [PATCH] 691 Added Python wrapper for pki pkcs12-import.



On 2016-02-25 12:42, Endi Sukma Dewata wrote:
> A wrapper has been added for the pki pkcs12-import command to
> allow implementing a workaround in Python to address JSS import
> limitations.
> 
> https://fedorahosted.org/pki/ticket/1742
> 
> Note: The build fails due to weird pylint errors. The Python code itself
> seems to be working just fine.

I fixed three small issues of your patch. The pki package vs. command
was a tricky one. Thanks for pointing it out. :)

Christian
From f39e809e305d815fc1b11b418e76caff82f75a9d Mon Sep 17 00:00:00 2001
From: Christian Heimes <cheimes redhat com>
Date: Thu, 25 Feb 2016 13:49:42 +0100
Subject: [PATCH] Misc fixes for pki-edewata-0691

CMakeLists.txt:
pki/ means 'copy content of directory to source', e.g.
site-packages/cert.py instead of site-packages/pki/cert.py

setup.py:
We must track all sub-packages manually.

pylint-build-scan.py:
pylint confuses the 'pki' package with the 'pki' command. The workaround
symlinks the command and analysis the command under its alternative
name.
---
 base/common/python/CMakeLists.txt |  4 +++-
 base/common/python/setup.py       |  2 +-
 scripts/pylint-build-scan.py      | 14 ++++++++++++--
 setup.py                          |  1 +
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/base/common/python/CMakeLists.txt b/base/common/python/CMakeLists.txt
index 0fa7638ec9fa6f45ec48720828e86b857fee1744..cf58b006e1f7719fb7b13e4017698e15d6d090d3 100644
--- a/base/common/python/CMakeLists.txt
+++ b/base/common/python/CMakeLists.txt
@@ -37,7 +37,9 @@ install(
     DIRECTORY
         pki/
     DESTINATION
-        ${PYTHON_SITE_PACKAGES}
+        ${PYTHON_SITE_PACKAGES}/pki/
+    FILES_MATCHING PATTERN
+        "*.py"
 )
 
 install(
diff --git a/base/common/python/setup.py b/base/common/python/setup.py
index 16c1d176051c2f787968f38543133aca1dada1fe..2ab033784ada038c3f6f79f2135d4146eddba250 100644
--- a/base/common/python/setup.py
+++ b/base/common/python/setup.py
@@ -84,7 +84,7 @@ and set up in less than an hour.""",
     license='GPL',
     keywords='pki x509 cert certificate',
     url='http://pki.fedoraproject.org/',
-    packages=['pki'],
+    packages=['pki', 'pki.cli'],
     requirements=['python-nss', 'requests', 'six'],
     classifiers=[
         'Development Status :: 5 - Production/Stable',
diff --git a/scripts/pylint-build-scan.py b/scripts/pylint-build-scan.py
index e0db8fcb35c78667d5e32d0eaee0a1f72505a509..d4156e87bdcd67d7aaac4b7053c77109d5b6e59c 100755
--- a/scripts/pylint-build-scan.py
+++ b/scripts/pylint-build-scan.py
@@ -38,7 +38,7 @@ PYLINTRC = os.path.join(SCRIPTPATH, 'dogtag.pylintrc')
 FILENAMES = [
     os.path.abspath(__file__),
     '{sitepackages}/pki',
-    '{bin}/pki',
+    '{bin}/pki-cmd',  # see HACK
     '{sbin}/pkispawn',
     '{sbin}/pkidestroy',
     '{sbin}/pki-upgrade',
@@ -130,7 +130,17 @@ def main():
     if args.verbose:
         pprint.pprint(pylint)
 
-    return subprocess.call(pylint, cwd=env['sitepackages'])
+    # HACK:
+    # pylint confuses the pki command with the pki package. We create a
+    # symlink from bin/pki to bin/pki-cmd and test bin/pki-cmd instead.
+    pki_bin = '{bin}/pki'.format(**env)
+    pki_cmd = '{bin}/pki-cmd'.format(**env)
+    os.symlink(pki_bin, pki_cmd)
+
+    try:
+        return subprocess.call(pylint, cwd=env['sitepackages'])
+    finally:
+        os.unlink(pki_cmd)
 
 if __name__ == '__main__':
     sys.exit(main())
diff --git a/setup.py b/setup.py
index 8b606fb815ca74a4f35a48dbf22323c4a7b020c5..a2cf6c34878728ea412f48ccef28dc1ffe8042c7 100644
--- a/setup.py
+++ b/setup.py
@@ -59,6 +59,7 @@ setup(
     },
     packages=[
         'pki',
+        'pki.cli',
         'pki.server',
         'pki.server.cli',
         'pki.server.deployment',
-- 
2.5.0

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]