[chrome-gnome-shell/feature/distutils] Use distutils for connector installtion



commit 2c4473b440700233b1df1c4e9bab90b9eab3cd3e
Author: Yuri Konotopov <ykonotopov gmail com>
Date:   Sun Aug 7 13:59:09 2016 +0300

    Use distutils for connector installtion

 CMakeLists.txt     |    8 +++++++-
 connector/setup.py |   17 +++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f2bae6d..12233a3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -80,12 +80,18 @@ if(BUILD_EXTENSION)
 endif(BUILD_EXTENSION)
 
 if(BUILD_CONNECTOR)
+       find_package(PythonInterp REQUIRED)
+
+       set(CONNECTOR_SETUP "${CMAKE_CURRENT_SOURCE_DIR}/connector/setup.py")
+       add_custom_target(build-connector ALL
+                       COMMAND ${PYTHON_EXECUTABLE} ${CONNECTOR_SETUP} build)
+
        configure_file("${CMAKE_CURRENT_SOURCE_DIR}/connector/io.github.ne0sight.gs_chrome_connector.json"
                        "${CMAKE_BINARY_DIR}/")
        configure_file("${CMAKE_CURRENT_SOURCE_DIR}/connector/org.gnome.chrome_gnome_shell.json"
                        "${CMAKE_BINARY_DIR}/")
 
-       install(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/connector/chrome-gnome-shell.py" DESTINATION 
"${CMAKE_INSTALL_BINDIR}/" RENAME chrome-gnome-shell)
+       install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CONNECTOR_SETUP} install)")
        install(FILES "${CMAKE_BINARY_DIR}/io.github.ne0sight.gs_chrome_connector.json" DESTINATION 
"/etc/chromium/native-messaging-hosts/")
        install(FILES "${CMAKE_BINARY_DIR}/io.github.ne0sight.gs_chrome_connector.json" DESTINATION 
"/etc/opt/chrome/native-messaging-hosts/")
        install(FILES "${CMAKE_BINARY_DIR}/org.gnome.chrome_gnome_shell.json" DESTINATION 
"/etc/chromium/native-messaging-hosts/")
diff --git a/connector/setup.py b/connector/setup.py
new file mode 100755
index 0000000..3b561f8
--- /dev/null
+++ b/connector/setup.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+
+import os
+import shutil
+from distutils.core import setup
+
+SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
+BUILD_DIR = SCRIPT_DIR + '/../build'
+SCRIPT_PATH = BUILD_DIR + '/chrome-gnome-shell'
+
+if not os.path.exists(BUILD_DIR):
+    os.makedirs(BUILD_DIR)
+shutil.copyfile(SCRIPT_DIR + '/chrome-gnome-shell.py', SCRIPT_PATH)
+
+setup(name='chrome-gnome-shell',
+      scripts=[SCRIPT_PATH]
+     )


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