From caef9a3291d66fcbf9e9129bf4104e30fcdf9f3b Mon Sep 17 00:00:00 2001 From: Benjamin Staffin Date: Fri, 14 Feb 2014 23:32:14 -0800 Subject: [PATCH 1/6] Don't hardcode python2.6. Change-Id: Ia2e977d833e3eca37ec0713a2ef73ebff03a7c9a --- PyKAdminErrors.h | 2 +- PyKAdminObject.h | 2 +- PyKAdminPolicyObject.h | 2 +- PyKAdminPrincipalObject.h | 2 +- kadmin.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/PyKAdminErrors.h b/PyKAdminErrors.h index 52f0f0d..c5dffd7 100644 --- a/PyKAdminErrors.h +++ b/PyKAdminErrors.h @@ -1,6 +1,6 @@ -#include +#include #include #include #include diff --git a/PyKAdminObject.h b/PyKAdminObject.h index 523a8fa..1361406 100644 --- a/PyKAdminObject.h +++ b/PyKAdminObject.h @@ -1,5 +1,5 @@ -#include +#include #include #include #include diff --git a/PyKAdminPolicyObject.h b/PyKAdminPolicyObject.h index ff8b468..31d09e6 100644 --- a/PyKAdminPolicyObject.h +++ b/PyKAdminPolicyObject.h @@ -1,5 +1,5 @@ -#include +#include #include #include #include diff --git a/PyKAdminPrincipalObject.h b/PyKAdminPrincipalObject.h index 849f197..02153d6 100644 --- a/PyKAdminPrincipalObject.h +++ b/PyKAdminPrincipalObject.h @@ -1,6 +1,6 @@ -#include +#include #include #include #include diff --git a/kadmin.c b/kadmin.c index 5c630f3..0df19b7 100644 --- a/kadmin.c +++ b/kadmin.c @@ -4,7 +4,7 @@ */ -#include +#include #include #include From 2057d38ca7facc435940eccac7bef169d1ab1ca5 Mon Sep 17 00:00:00 2001 From: Benjamin Staffin Date: Fri, 14 Feb 2014 23:32:51 -0800 Subject: [PATCH 2/6] Ignore editor swap files. Change-Id: Icfd305cf984668eb28c32f6dd9e16a57b92bca7b --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 0331bbb..d469eb6 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,7 @@ *.exe *.out *.app + +# Editor turds +.*.swp +*~ From e7e5da7478ead1b0fc963ef59a4e59fc3a48f47c Mon Sep 17 00:00:00 2001 From: Benjamin Staffin Date: Fri, 14 Feb 2014 23:33:05 -0800 Subject: [PATCH 3/6] Unknown autoconf.h include. Works without it? Change-Id: I1d2ea4e1f7e534e62226abe1221c1e586ebbabe3 --- getdate.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getdate.y b/getdate.y index fec14ac..13073dc 100644 --- a/getdate.y +++ b/getdate.y @@ -13,7 +13,7 @@ /* SUPPRESS 287 on yaccpar_sccsid *//* Unusd static variable */ /* SUPPRESS 288 on yyerrlab *//* Label unused */ -#include "autoconf.h" +//#include "autoconf.h" #include #include From 007e28583b200c919cd6778e2cfbd465f9df2e25 Mon Sep 17 00:00:00 2001 From: Benjamin Staffin Date: Fri, 14 Feb 2014 23:33:56 -0800 Subject: [PATCH 4/6] Reformat setup.py for readability. Change-Id: Id62d54730c06b71ee3bbf7c3704789b3ff7e75e6 --- setup.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index d79df23..1c18f73 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,22 @@ +#!/usr/bin/env python + from distutils.core import setup, Extension setup( ext_modules=[ - Extension("kadmin", - libraries = ["krb5", "kadm5clnt"], - library_dirs = ["/usr/lib64/"], - include_dirs = ["/usr/include/et/"], - sources = ["./kadmin.c", "./PyKAdminErrors.c", "./PyKAdminObject.c", "./PyKAdminPrincipalObject.c", "getdate.c"], - - ) + Extension( + "kadmin", + libraries=["krb5", "kadm5clnt"], + library_dirs=["/usr/lib64/"], + include_dirs=["/usr/include/et/"], + sources=[ + "./kadmin.c", + "./PyKAdminErrors.c", + "./PyKAdminObject.c", + "./PyKAdminPrincipalObject.c", + "getdate.c" + ] + ) ] ) #/usr/lib64/libkadm5clnt_mit.so From dafb4c453451f401eee7e850ed5941b9022575e6 Mon Sep 17 00:00:00 2001 From: Benjamin Staffin Date: Sat, 15 Feb 2014 00:09:10 -0800 Subject: [PATCH 5/6] Omit gratuitous includes. Change-Id: I99ad625a33abddccf12c4d86912d33be707db865 --- setup.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.py b/setup.py index 1c18f73..9ca024c 100644 --- a/setup.py +++ b/setup.py @@ -7,8 +7,6 @@ Extension( "kadmin", libraries=["krb5", "kadm5clnt"], - library_dirs=["/usr/lib64/"], - include_dirs=["/usr/include/et/"], sources=[ "./kadmin.c", "./PyKAdminErrors.c", From 579bc871634506713bc3f6cd453bb3f62991457b Mon Sep 17 00:00:00 2001 From: Benjamin Staffin Date: Sat, 15 Feb 2014 00:52:21 -0800 Subject: [PATCH 6/6] Enhance setup.py, obviate other build scripts Add generated getdate.c to .gitignore Change-Id: I2640cfd8bae3ace1f69578de5a1dd88d46184870 --- .gitignore | 3 +++ build.bash | 2 -- setup.bash | 6 ------ setup.py | 54 ++++++++++++++++++++++++++++++++++++++---------------- 4 files changed, 41 insertions(+), 24 deletions(-) delete mode 100755 build.bash delete mode 100644 setup.bash diff --git a/.gitignore b/.gitignore index d469eb6..7f88f42 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,6 @@ # Editor turds .*.swp *~ + +# Generated +getdate.c diff --git a/build.bash b/build.bash deleted file mode 100755 index 360f45b..0000000 --- a/build.bash +++ /dev/null @@ -1,2 +0,0 @@ -clear -python setup.py build_ext --inplace diff --git a/setup.bash b/setup.bash deleted file mode 100644 index 7b01fdd..0000000 --- a/setup.bash +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -bison -y -o getdate.c getdate.y - -python setup.py build_ext --inplace - diff --git a/setup.py b/setup.py index 9ca024c..dab150e 100644 --- a/setup.py +++ b/setup.py @@ -1,20 +1,42 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- from distutils.core import setup, Extension +from distutils.util import execute, newer +from distutils.spawn import spawn -setup( - ext_modules=[ - Extension( - "kadmin", - libraries=["krb5", "kadm5clnt"], - sources=[ - "./kadmin.c", - "./PyKAdminErrors.c", - "./PyKAdminObject.c", - "./PyKAdminPrincipalObject.c", - "getdate.c" - ] - ) - ] - ) - #/usr/lib64/libkadm5clnt_mit.so + +if newer('getdate.y', 'getdate.c'): + execute(spawn, (['bison', '-y', '-o', 'getdate.c', 'getdate.y'],)) + +setup(name='kadmin', + description='Python module for kerberos admin (kadm5)', + url='https://github.com/russjancewicz/python-kadmin', + author='Russell Jancewicz', + author_email='russell.jancewicz@gmail.com', + ext_modules=[ + Extension( + "kadmin", + libraries=["krb5", "kadm5clnt"], + sources=[ + "./kadmin.c", + "./PyKAdminErrors.c", + "./PyKAdminObject.c", + "./PyKAdminPrincipalObject.c", + "getdate.c" + ] + ) + ], + classifiers=[ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: System Administrators", + "Intended Audience :: Developers", + "Operating System :: POSIX", + "Programming Language :: C", + "Programming Language :: Python", + "Programming Language :: YACC", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: System :: Systems Administration :: Authentication/Directory", + ] + )