Browse Source

Set up distributing the python bindings

Bradlee Speice 7 years ago
parent
commit
3d18823b46
5 changed files with 43 additions and 5 deletions
  1. 11
    3
      Makefile.am
  2. 9
    2
      configure.ac
  3. 16
    0
      python/Makefile.am
  4. 2
    0
      python/libcvautomation.py
  5. 5
    0
      python/setup.py.in

+ 11
- 3
Makefile.am View File

@@ -1,9 +1,17 @@
1 1
 if BUILD_DOXYGEN
2
-SUBDIRS = libcvautomation examples docs
3
-else
4
-SUBDIRS = libcvautomation examples
2
+  DOCS_ENABLE = docs
5 3
 endif
6 4
 
5
+if BUILD_PYTHON
6
+  PYTHON_ENABLE = python
7
+endif
8
+
9
+if BUILD_EXAMPLES
10
+  EXAMPLES_ENABLE = examples
11
+endif
12
+
13
+SUBDIRS = libcvautomation $(EXAMPLES_ENABLE) $(PYTHON_ENABLE) $(DOCS_ENABLE)
14
+
7 15
 #And the BASH macros
8 16
 dist_sysconf_DATA = libcvautomation_funcs
9 17
 

+ 9
- 2
configure.ac View File

@@ -80,7 +80,7 @@ if test "$with_docs" != "no"; then
80 80
 		enable_tex="no"
81 81
 	else
82 82
 		AM_CONDITIONAL(BUILD_DOXYGEN, [test "$with_docs" != "no"])
83
-		AC_CONFIG_FILES([docs/Doxyfile_library] [docs/Doxyfile_example])
83
+		AC_CONFIG_FILES([docs/Doxyfile_library] [docs/Doxyfile_example] [docs/Makefile])
84 84
 	fi
85 85
 else
86 86
 	AM_CONDITIONAL(BUILD_DOXYGEN, [test "$with_docs" != "no"]) #false
@@ -106,6 +106,14 @@ else
106 106
 	AM_CONDITIONAL(BUILD_TEX, [test "$enable_tex" == "yes"]) #false
107 107
 fi
108 108
 
109
+AC_ARG_WITH(python, [  --with-python           Install python support for libcvautomation])
110
+#Check if we should distribute Python
111
+if test "$with_python" != "no"; then
112
+	AC_CHECK_PROGS([Python], [python], [missing])
113
+	AC_CONFIG_FILES([python/Makefile] [python/setup.py])
114
+fi
115
+AM_CONDITIONAL(BUILD_PYTHON, [test "$with_python" != "no"]) #true unless --without-python
116
+
109 117
 # Checks for library functions.
110 118
 AC_FUNC_MALLOC
111 119
 
@@ -120,7 +128,6 @@ AC_OUTPUT(
120 128
 [Makefile]
121 129
 [libcvautomation/Makefile]
122 130
 [examples/Makefile]
123
-[docs/Makefile]
124 131
 [libcvautomation.pc]
125 132
 [include/libcvautomation/libcvautomation.h]
126 133
 [rpm/libcvautomation.spec]

+ 16
- 0
python/Makefile.am View File

@@ -0,0 +1,16 @@
1
+EXTRA_DIST = libcvautomation.py
2
+
3
+install-data-local: setup.py
4
+	$(Python) setup.py install
5
+	
6
+##Unfortunately, we can't really uninstall the python file.
7
+##The python dist-utils don't tell us where it got installed
8
+##to, so we can't uninstall it.
9
+##uninstall-local:
10
+
11
+CLEANFILES = setup.py
12
+
13
+all-local: libcvautomation.py
14
+clean-local:
15
+	rm -rf setup.py
16
+

+ 2
- 0
python/libcvautomation.py View File

@@ -0,0 +1,2 @@
1
+class libcvautomation:
2
+	pass

+ 5
- 0
python/setup.py.in View File

@@ -0,0 +1,5 @@
1
+from distutils.core import setup
2
+setup(name='@PACKAGE_NAME@',
3
+		version='@PACKAGE_VERSION@',
4
+		py_modules=['@PACKAGE_NAME@'],
5
+		)

Loading…
Cancel
Save