From 3d18823b4631e9f967b6db79316430e538a22af6 Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Mon, 13 Aug 2012 12:05:42 -0400 Subject: [PATCH] Set up distributing the python bindings --- Makefile.am | 14 +++++++++++--- configure.ac | 11 +++++++++-- python/Makefile.am | 16 ++++++++++++++++ python/libcvautomation.py | 2 ++ python/setup.py.in | 5 +++++ 5 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 python/Makefile.am create mode 100644 python/libcvautomation.py create mode 100644 python/setup.py.in diff --git a/Makefile.am b/Makefile.am index 9d05643..036e8a5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,9 +1,17 @@ if BUILD_DOXYGEN -SUBDIRS = libcvautomation examples docs -else -SUBDIRS = libcvautomation examples + DOCS_ENABLE = docs endif +if BUILD_PYTHON + PYTHON_ENABLE = python +endif + +if BUILD_EXAMPLES + EXAMPLES_ENABLE = examples +endif + +SUBDIRS = libcvautomation $(EXAMPLES_ENABLE) $(PYTHON_ENABLE) $(DOCS_ENABLE) + #And the BASH macros dist_sysconf_DATA = libcvautomation_funcs diff --git a/configure.ac b/configure.ac index 3816c0b..6f3c030 100644 --- a/configure.ac +++ b/configure.ac @@ -80,7 +80,7 @@ if test "$with_docs" != "no"; then enable_tex="no" else AM_CONDITIONAL(BUILD_DOXYGEN, [test "$with_docs" != "no"]) - AC_CONFIG_FILES([docs/Doxyfile_library] [docs/Doxyfile_example]) + AC_CONFIG_FILES([docs/Doxyfile_library] [docs/Doxyfile_example] [docs/Makefile]) fi else AM_CONDITIONAL(BUILD_DOXYGEN, [test "$with_docs" != "no"]) #false @@ -106,6 +106,14 @@ else AM_CONDITIONAL(BUILD_TEX, [test "$enable_tex" == "yes"]) #false fi +AC_ARG_WITH(python, [ --with-python Install python support for libcvautomation]) +#Check if we should distribute Python +if test "$with_python" != "no"; then + AC_CHECK_PROGS([Python], [python], [missing]) + AC_CONFIG_FILES([python/Makefile] [python/setup.py]) +fi +AM_CONDITIONAL(BUILD_PYTHON, [test "$with_python" != "no"]) #true unless --without-python + # Checks for library functions. AC_FUNC_MALLOC @@ -120,7 +128,6 @@ AC_OUTPUT( [Makefile] [libcvautomation/Makefile] [examples/Makefile] -[docs/Makefile] [libcvautomation.pc] [include/libcvautomation/libcvautomation.h] [rpm/libcvautomation.spec] diff --git a/python/Makefile.am b/python/Makefile.am new file mode 100644 index 0000000..6a6884f --- /dev/null +++ b/python/Makefile.am @@ -0,0 +1,16 @@ +EXTRA_DIST = libcvautomation.py + +install-data-local: setup.py + $(Python) setup.py install + +##Unfortunately, we can't really uninstall the python file. +##The python dist-utils don't tell us where it got installed +##to, so we can't uninstall it. +##uninstall-local: + +CLEANFILES = setup.py + +all-local: libcvautomation.py +clean-local: + rm -rf setup.py + diff --git a/python/libcvautomation.py b/python/libcvautomation.py new file mode 100644 index 0000000..1222e51 --- /dev/null +++ b/python/libcvautomation.py @@ -0,0 +1,2 @@ +class libcvautomation: + pass diff --git a/python/setup.py.in b/python/setup.py.in new file mode 100644 index 0000000..9147cdf --- /dev/null +++ b/python/setup.py.in @@ -0,0 +1,5 @@ +from distutils.core import setup +setup(name='@PACKAGE_NAME@', + version='@PACKAGE_VERSION@', + py_modules=['@PACKAGE_NAME@'], + )