comparison setup.py @ 1086:2566f17a0e59

server (setup): New setup.py compatible with archlinux PKGBUILD. This file use a new "arch" option in LIBERVIA_INSTALL environment variable (which is set when libervia is installed with PKGBUILD. This setup.py solves the following issues: - os.symlink(os.path.dirname(libervia.__file__), os.path.join(tmp_dir,"libervia")) fails with PKGBUILD because the module libervia is not accessible. - self.custom_create_links() fails with PKGBUILD because the permissions of bin directory is read-only.
author Arnaud Joset <info@agayon.be>
date Mon, 02 Apr 2018 10:39:55 +0200
parents 3bf61858a123
children 1f67b003c312
comparison
equal deleted inserted replaced
1085:1c09f41e2f52 1086:2566f17a0e59
114 """Build the browser side JS files from Python source.""" 114 """Build the browser side JS files from Python source."""
115 cwd = os.getcwd() 115 cwd = os.getcwd()
116 os.chdir(os.path.join('src', 'browser')) 116 os.chdir(os.path.join('src', 'browser'))
117 # we must have only certain package in the path, so we create a tmp dir to link only what we need 117 # we must have only certain package in the path, so we create a tmp dir to link only what we need
118 tmp_dir = tempfile.mkdtemp() 118 tmp_dir = tempfile.mkdtemp()
119 import sat, sat_frontends, libervia 119 import sat, sat_frontends
120 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.__file__), os.path.join(tmp_dir,"sat")) # FIXME: only work on unixes
121 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(sat_frontends.__file__), os.path.join(tmp_dir,"sat_frontends")) # FIXME: only work on unixes
122 os.symlink(os.path.dirname(libervia.__file__), os.path.join(tmp_dir,"libervia")) # FIXME: only work on unixes 122 libervia_files = os.path.abspath("../../src")
123 os.symlink(libervia_files, os.path.join(tmp_dir,"libervia")) # FIXME: only work on unixes
123 for module in ('libervia_main', 'libervia_test'): 124 for module in ('libervia_main', 'libervia_test'):
124 build_args = ['pyjsbuild', module] + (['-d'] if JS_DEBUG in install_opt else []) + ['--no-compile-inplace', '-I', tmp_dir, '-o', self.pyjamas_output_dir] 125 build_args = ['pyjsbuild', module] + (['-d'] if JS_DEBUG in install_opt else []) + ['--no-compile-inplace', '-I', tmp_dir, '-o', self.pyjamas_output_dir]
125 result = subprocess.call(build_args) 126 result = subprocess.call(build_args)
126 if result != 0: 127 if result != 0:
127 continue 128 continue
166 if build_result != 0: 167 if build_result != 0:
167 print "pyjsbuild failed to build libervia" 168 print "pyjsbuild failed to build libervia"
168 return 169 return
169 self.copy_data_files() 170 self.copy_data_files()
170 self.custom_auto_options() 171 self.custom_auto_options()
171 self.custom_create_links() 172 if not "arch" in install_opt:
173 self.custom_create_links()
172 174
173 def confirm(self, message): 175 def confirm(self, message):
174 """Ask the user for a confirmation""" 176 """Ask the user for a confirmation"""
175 message += 'Proceed' 177 message += 'Proceed'
176 while True: 178 while True: