comparison setup.py @ 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 77bf2654ca0a
children 0a06cf833f5a
comparison
equal deleted inserted replaced
562:7e8356479fef 563:d888bb2a23a9
27 import sys 27 import sys
28 import subprocess 28 import subprocess
29 from stat import ST_MODE 29 from stat import ST_MODE
30 import shutil 30 import shutil
31 from src.server.constants import Const as C 31 from src.server.constants import Const as C
32 import tempfile
32 33
33 # seen here: http://stackoverflow.com/questions/7275295 34 # seen here: http://stackoverflow.com/questions/7275295
34 try: 35 try:
35 from setuptools.command import egg_info 36 from setuptools.command import egg_info
36 egg_info.write_toplevel_names 37 egg_info.write_toplevel_names
110 111
111 def pyjs_build(self): 112 def pyjs_build(self):
112 """Build the browser side JS files from Python source.""" 113 """Build the browser side JS files from Python source."""
113 cwd = os.getcwd() 114 cwd = os.getcwd()
114 os.chdir(os.path.join('src', 'browser')) 115 os.chdir(os.path.join('src', 'browser'))
115 result = subprocess.call('pyjsbuild libervia_main --no-compile-inplace -I %s -o %s' % 116 # we must have only certain package in the path, so we create a tmp dir to link only what we need
116 (self.install_lib, self.pyjamas_output_dir), shell=True) 117 tmp_dir = tempfile.mkdtemp()
118 import sat, sat_frontends, libervia
119 os.symlink(os.path.dirname(sat.__file__), os.path.join(tmp_dir,"sat")) # FIXME: only work on unixes
120 os.symlink(os.path.dirname(sat_frontends.__file__), os.path.join(tmp_dir,"sat_frontends")) # FIXME: only work on unixes
121 os.symlink(os.path.dirname(libervia.__file__), os.path.join(tmp_dir,"libervia")) # FIXME: only work on unixes
122 result = subprocess.call(['pyjsbuild', 'libervia_main', '--no-compile-inplace', '-I', tmp_dir, '-o', self.pyjamas_output_dir])
123 shutil.rmtree(tmp_dir)
117 os.chdir(cwd) 124 os.chdir(cwd)
118 return result 125 return result
119 126
120 def copy_data_files(self): 127 def copy_data_files(self):
121 # XXX: To copy the JS files couldn't be done with the data_files parameter 128 # XXX: To copy the JS files couldn't be done with the data_files parameter