changeset 563:d888bb2a23a9

installation: pyjamas build fixes: - replaced string subprocess call by a list (argument were not escaped properly) - fixed inclusion: to avoid bad inclusion leading to compilation errors, we create a temporary directory with symlinks to only what we need
author Goffi <goffi@goffi.org>
date Fri, 03 Oct 2014 19:38:10 +0200
parents 7e8356479fef
children fed185c95f1c
files setup.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Fri Oct 03 18:31:40 2014 +0200
+++ b/setup.py	Fri Oct 03 19:38:10 2014 +0200
@@ -29,6 +29,7 @@
 from stat import ST_MODE
 import shutil
 from src.server.constants import Const as C
+import tempfile
 
 # seen here: http://stackoverflow.com/questions/7275295
 try:
@@ -112,8 +113,14 @@
         """Build the browser side JS files from Python source."""
         cwd = os.getcwd()
         os.chdir(os.path.join('src', 'browser'))
-        result = subprocess.call('pyjsbuild libervia_main --no-compile-inplace -I %s -o %s' %
-                                 (self.install_lib, self.pyjamas_output_dir), shell=True)
+        # we must have only certain package in the path, so we create a tmp dir to link only what we need
+        tmp_dir = tempfile.mkdtemp()
+        import sat, sat_frontends, libervia
+        os.symlink(os.path.dirname(sat.__file__), os.path.join(tmp_dir,"sat")) # FIXME: only work on unixes
+        os.symlink(os.path.dirname(sat_frontends.__file__), os.path.join(tmp_dir,"sat_frontends")) # FIXME: only work on unixes
+        os.symlink(os.path.dirname(libervia.__file__), os.path.join(tmp_dir,"libervia")) # FIXME: only work on unixes
+        result = subprocess.call(['pyjsbuild', 'libervia_main', '--no-compile-inplace', '-I', tmp_dir, '-o', self.pyjamas_output_dir])
+        shutil.rmtree(tmp_dir)
         os.chdir(cwd)
         return result