compiz team mailing list archive
-
compiz team
-
Mailing list archive
-
Message #34715
[Merge] lp:~compiz-team/compiz/build-fixes-part-3-compizconfig-python into lp:compiz
Sam Spilsbury has proposed merging lp:~compiz-team/compiz/build-fixes-part-3-compizconfig-python into lp:compiz with lp:~compiz-team/compiz/build-fixes-part-2 as a prerequisite.
Requested reviews:
compiz packagers (compiz)
For more details, see:
https://code.launchpad.net/~compiz-team/compiz/build-fixes-part-3-compizconfig-python/+merge/106515
Testers should really test the last item in the branch pipeline lp:~compiz-team/compiz/build-fixes-part-10-animationaddon-plugin
This branch gets compizconfig-python working using slightly saner build rules
--
https://code.launchpad.net/~compiz-team/compiz/build-fixes-part-3-compizconfig-python/+merge/106515
Your team compiz packagers is requested to review the proposed merge of lp:~compiz-team/compiz/build-fixes-part-3-compizconfig-python into lp:compiz.
=== modified file 'compizconfig/CMakeLists.txt'
--- compizconfig/CMakeLists.txt 2012-05-20 10:47:01 +0000
+++ compizconfig/CMakeLists.txt 2012-05-20 10:47:06 +0000
@@ -5,8 +5,8 @@
set (COMPIZCONFIG_LIBRARY_DIRS ${CMAKE_CURRENT_BINARY_DIR}/libcompizconfig)
add_subdirectory (libcompizconfig)
-#add_subdirectory (compizconfig-python)
-#add_subdirectory (ccsm)
+add_subdirectory (compizconfig-python)
+add_subdirectory (ccsm)
#add_subdirectory (gconf)
#add_subdirectory (gsettings)
=== modified file 'compizconfig/ccsm/CMakeLists.txt'
--- compizconfig/ccsm/CMakeLists.txt 2012-05-20 10:47:01 +0000
+++ compizconfig/ccsm/CMakeLists.txt 2012-05-20 10:47:06 +0000
@@ -14,11 +14,6 @@
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating Python Bytecode")
-add_custom_target (install
- COMMAND python setup.py install --prefix=${CMAKE_INSTALL_PREFIX}
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMENT "Installing Python Files")
-
add_custom_target (pyclean_ccsm
COMMAND python setup.py clean
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@@ -29,6 +24,11 @@
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Uninstalling Python Files")
+install (CODE
+ "message (\"Installing python files\")
+ execute_process (COMMAND python setup.py install --prefix=${CMAKE_INSTALL_PREFIX}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})")
+
#add_dependencies (clean pyclean)
compiz_print_configure_header ("CompizConfig Settings Manager")
=== modified file 'compizconfig/compizconfig-python/CMakeLists.txt'
--- compizconfig/compizconfig-python/CMakeLists.txt 2012-05-20 10:47:01 +0000
+++ compizconfig/compizconfig-python/CMakeLists.txt 2012-05-20 10:47:06 +0000
@@ -9,28 +9,57 @@
set (VERSION ${COMPIZ_RELEASE_VERSION})
-add_custom_target (python ALL
- COMMAND python setup.py build
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/compizconfig_wrapper.c
+ COMMAND echo \"int main (void) { return 0\; }\" >> ${CMAKE_CURRENT_BINARY_DIR}/compizconfig_wrapper.c
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+
+# Get arch
+execute_process (COMMAND uname -p OUTPUT_VARIABLE PROC_ARCH)
+
+# Get Python Version
+execute_process (COMMAND python -c "import sys; print str (sys.version_info.major) + '.' + str (sys.version_info.minor)"
+ OUTPUT_VARIABLE PY_VERSION)
+
+string (REPLACE "\n" "" PROC_ARCH ${PROC_ARCH})
+string (REPLACE "\n" "" PY_VERSION ${PY_VERSION})
+
+set (PY_BUILD_DIR lib.linux-${PROC_ARCH}-${PY_VERSION})
+set (PY_SCRIPTS_DIR scripts-${PY_VERSION})
+
+set (PY_COMPIZCONFIG_SRC ${CMAKE_CURRENT_BINARY_DIR}/compizconfig.c)
+set (PY_COMPIZCONFIG_VERSION ${CMAKE_CURRENT_BINARY_DIR}/VERSION)
+
+add_custom_command (OUTPUT ${PY_COMPIZCONFIG_VERSION}
+ COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/VERSION ${CMAKE_CURRENT_BINARY_DIR}/VERSION)
+
+add_custom_command (OUTPUT ${PY_COMPIZCONFIG_SRC}
+ COMMAND cython -o ${PY_COMPIZCONFIG_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/src/compizconfig.pyx
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+set (PY_COMPIZCONFIG_LIB ${CMAKE_CURRENT_BINARY_DIR}/build/${PY_BUILD_DIR}/compizconfig.so)
+
+add_custom_command (OUTPUT ${PY_COMPIZCONFIG_LIB}
+ COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/setup.py build --build-base=${CMAKE_CURRENT_BINARY_DIR}/build
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${PY_COMPIZCONFIG_SRC} ${PY_COMPIZCONFIG_VERSION}
COMMENT "Generating Python Bytecode")
-add_custom_target (install
- COMMAND python setup.py install --prefix=${CMAKE_INSTALL_PREFIX}
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMENT "Installing Python Files")
-
-add_custom_target (pyclean_ccsm
- COMMAND python setup.py clean
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMENT "Cleaning Python Files")
+add_library (compizconfig_wrapper
+ ${CMAKE_CURRENT_BINARY_DIR}/compizconfig_wrapper.c
+ ${PY_COMPIZCONFIG_LIB})
add_custom_target (uninstall
- COMMAND python setup.py uninstall
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/setup.py uninstall
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Uninstalling Python Files")
-#add_dependencies (clean pyclean)
-add_dependencies (python compizconfig)
+
+install (CODE
+ "message (\"Installing python files\")
+ execute_process (COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/setup.py install --prefix=${CMAKE_INSTALL_PREFIX}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
+
+add_dependencies (compizconfig_wrapper compizconfig)
find_program (PYTHON_EXECUTABLE python)
mark_as_advanced (FORCE PYTHON_EXECUTABLE)
@@ -41,7 +70,7 @@
foreach (PYTHON_TEST_FILE ${PYTHON_TESTS})
get_filename_component (PYTHON_TEST ${PYTHON_TEST_FILE} NAME_WE)
message (STATUS "Adding test " ${PYTHON_TEST})
- add_test (NAME ${PYTHON_TEST} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tests" COMMAND ${PYTHON_EXECUTABLE} -m unittest ${PYTHON_TEST})
+ add_test (NAME ${PYTHON_TEST} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tests" COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_TEST})
endforeach (PYTHON_TEST_FILE)
endif (PYTHON_EXECUTABLE)
@@ -52,5 +81,3 @@
compiz_add_distcheck ()
compiz_add_release ()
compiz_add_release_signoff ()
-
-
=== modified file 'compizconfig/compizconfig-python/setup.py'
--- compizconfig/compizconfig-python/setup.py 2012-05-20 10:47:01 +0000
+++ compizconfig/compizconfig-python/setup.py 2012-05-20 10:47:06 +0000
@@ -11,13 +11,17 @@
import unittest
import os
+pkg_config_environ = os.environ
+pkg_config_environ["PKG_CONFIG_PATH"] = os.getcwd () + "/../libcompizconfig:" + os.environ.get ("PKG_CONFIG_PATH", '')
+
# If src/compizconfig.pyx exists, build using Cython
-if os.path.exists ("src/compizconfig.pyx"):
+if os.path.exists (os.getcwd () + "/src/compizconfig.pyx"):
from Cython.Distutils import build_ext
- ext_module_src = "src/compizconfig.pyx"
+ print "using pyx"
+ ext_module_src = os.getcwd () + "/src/compizconfig.pyx"
else: # Otherwise build directly from C source
from distutils.command.build_ext import build_ext
- ext_module_src = "src/compizconfig.c"
+ ext_module_src = os.getcwd () + "/compizconfig.c"
version_file = open ("VERSION", "r")
version = version_file.read ().strip ()
@@ -28,7 +32,7 @@
flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries', '-R': 'runtime_library_dirs'}
cmd = ['pkg-config', '--libs', '--cflags']
- tokens = subprocess.Popen (cmd + list(packages), stdout=subprocess.PIPE).communicate()[0].split ()
+ tokens = subprocess.Popen (cmd + list(packages), stdout=subprocess.PIPE, env=pkg_config_environ).communicate()[0].split ()
for t in tokens:
if '-L' in t[:2]:
@@ -44,10 +48,10 @@
VERSION_FILE = os.path.join (os.path.dirname (__file__), "VERSION")
-pkgconfig_libs = subprocess.Popen (["pkg-config", "--libs", "libcompizconfig"], stdout=subprocess.PIPE, stderr=open(os.devnull, 'w')).communicate ()[0]
+pkgconfig_libs = subprocess.Popen (["pkg-config", "--libs", "libcompizconfig_internal"], stdout=subprocess.PIPE, env=pkg_config_environ, stderr=open(os.devnull, 'w')).communicate ()[0]
if len (pkgconfig_libs) is 0:
- print ("CompizConfig Python [ERROR]: No libcompizconfig.pc found in the pkg-config search path")
+ print ("CompizConfig Python [ERROR]: No libcompizconfig_internal.pc found in the pkg-config search path")
print ("Ensure that libcompizonfig is installed or libcompizconfig.pc is in your $PKG_CONFIG_PATH")
exit (1);
libs = pkgconfig_libs[2:].split (" ")[0]
@@ -120,7 +124,7 @@
# Build C file
if os.path.exists ("src/compizconfig.pyx"):
from Cython.Compiler.Main import compile as cython_compile
- cython_compile ("src/compizconfig.pyx")
+ cython_compile ("src/compizconfig.pyx", output_file=os.getcwd () + "/compizconfig.c")
# Run regular sdist
_sdist.run (self)
@@ -129,7 +133,7 @@
# Remove pyx source and add c source
if os.path.exists ("src/compizconfig.pyx"):
self.filelist.exclude_pattern ("src/compizconfig.pyx")
- self.filelist.append ("src/compizconfig.c")
+ self.filelist.append ("compizconfig.c")
class test (Command):
description = "run tests"
@@ -167,7 +171,7 @@
"test" : test},
ext_modules=[
Extension ("compizconfig", [ext_module_src],
- **pkgconfig("libcompizconfig"))
+ **pkgconfig("libcompizconfig_internal"))
]
)
=== modified file 'compizconfig/compizconfig-python/tests/test_backend.py'
--- compizconfig/compizconfig-python/tests/test_backend.py 2012-05-20 10:47:01 +0000
+++ compizconfig/compizconfig-python/tests/test_backend.py 2012-05-20 10:47:06 +0000
@@ -1,4 +1,5 @@
import compiz_config_test
+import unittest
class CompizConfigTestBackend (compiz_config_test.CompizConfigTest):
@@ -13,3 +14,6 @@
self.assertEqual (backend.LongDesc, "Flat File Backend")
self.assertEqual (backend.IntegrationSupport, False)
self.assertEqual (backend.ProfileSupport, True)
+
+if __name__ == '__main__':
+ unittest.main()
=== modified file 'compizconfig/compizconfig-python/tests/test_plugin.py'
--- compizconfig/compizconfig-python/tests/test_plugin.py 2012-05-20 10:47:01 +0000
+++ compizconfig/compizconfig-python/tests/test_plugin.py 2012-05-20 10:47:06 +0000
@@ -1,4 +1,5 @@
import compiz_config_test
+import unittest
class CompizConfigTestPlugin (compiz_config_test.CompizConfigTest):
@@ -15,3 +16,6 @@
self.assertTrue (plugin.Category is not None)
self.assertTrue (plugin.Features is not None)
self.assertTrue (plugin.Initialized is True)
+
+if __name__ == '__main__':
+ unittest.main()
=== modified file 'compizconfig/compizconfig-python/tests/test_profile.py'
--- compizconfig/compizconfig-python/tests/test_profile.py 2012-05-20 10:47:01 +0000
+++ compizconfig/compizconfig-python/tests/test_profile.py 2012-05-20 10:47:06 +0000
@@ -1,4 +1,5 @@
import compiz_config_test
+import unittest
class CompizConfigProfileTest (compiz_config_test.CompizConfigTest):
@@ -10,3 +11,6 @@
self.assertEqual (profile1.Name, "compizconfig2", 'wrong profile name')
profile2 = self.ccs.Profile (self.context, "compizconfig3")
self.assertEqual (profile2.Name, "compizconfig3", 'wrong profile name')
+
+if __name__ == '__main__':
+ unittest.main()
=== modified file 'compizconfig/compizconfig-python/tests/test_setting.py'
--- compizconfig/compizconfig-python/tests/test_setting.py 2012-05-20 10:47:01 +0000
+++ compizconfig/compizconfig-python/tests/test_setting.py 2012-05-20 10:47:06 +0000
@@ -1,4 +1,5 @@
import compiz_config_test
+import unittest
class CompizConfigTestSetting (compiz_config_test.CompizConfigTest):
@@ -19,3 +20,6 @@
self.assertTrue (setting.Value is not None)
self.assertEqual (setting.Integrated, False)
self.assertEqual (setting.ReadOnly, False)
+
+if __name__ == '__main__':
+ unittest.main()
=== modified file 'compizconfig/libcompizconfig/CMakeLists.txt'
--- compizconfig/libcompizconfig/CMakeLists.txt 2012-05-20 10:47:01 +0000
+++ compizconfig/libcompizconfig/CMakeLists.txt 2012-05-20 10:47:06 +0000
@@ -133,6 +133,11 @@
${CMAKE_CURRENT_BINARY_DIR}/libcompizconfig.pc
)
+compiz_configure_file (
+ ${CMAKE_CURRENT_SOURCE_DIR}/libcompizconfig_internal.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/libcompizconfig_internal.pc
+)
+
install (
FILES ${CMAKE_CURRENT_BINARY_DIR}/libcompizconfig.pc
DESTINATION ${COMPIZ_DESTDIR}${libdir}/pkgconfig
=== added file 'compizconfig/libcompizconfig/libcompizconfig_internal.pc.in'
--- compizconfig/libcompizconfig/libcompizconfig_internal.pc.in 1970-01-01 00:00:00 +0000
+++ compizconfig/libcompizconfig/libcompizconfig_internal.pc.in 2012-05-20 10:47:06 +0000
@@ -0,0 +1,12 @@
+prefix=@CMAKE_CURRENT_BINARY_DIR@/src/
+exec_prefix=@CMAKE_CURRENT_BINARY_DIR@/src/
+libdir=@CMAKE_CURRENT_BINARY_DIR@/src/
+includedir=@CMAKE_CURRENT_SOURCE_DIR@/include
+
+Name: libcompizconfig_internal
+Description: Compiz configuration system (internal)
+Version: @VERSION@
+
+Libs: -L@CMAKE_CURRENT_BINARY_DIR@/src/ -lcompizconfig
+Cflags: -I@CMAKE_CURRENT_SOURCE_DIR@/include
+