def make_dist(self): makedirs(self.dist_dir) if sys.platform == "win32": # Bake version number into the dispatchers and the help files and create rotarama db # This is done during installation on other platforms from libtbx.auto_build import installer_utils arg = [os.path.join(self.dest_dir,'base','bin','python','python.exe'), os.path.join(self.dest_dir,'bin','install.py'), '--nopycompile'] installer_utils.call(arg, cwd=self.dest_dir) print "Creating zip archive of distribution" fname = os.path.join(self.dist_dir, '%s.zip'%os.path.basename(self.dest_dir)) myzip = zipfile.ZipFile(fname, 'w', zipfile.ZIP_DEFLATED, allowZip64=True ) for dirpath,dirs,files in os.walk(self.dest_dir): for f in files: fname = os.path.join(dirpath, f) relfname = os.path.relpath(fname, os.path.join(os.getcwd(), "tmp")) myzip.write(filename=fname, arcname=relfname) myzip.close() else: print "Creating tar archive of distribution" tar( os.path.basename(self.dest_dir), os.path.join(self.dist_dir, '%s.tar.gz'%os.path.basename(self.dest_dir)), cwd=os.path.join(self.dest_dir, '..') )
def make_dist(self): makedirs(self.dist_dir) if sys.platform == "win32": # Bake version number into the dispatchers and the help files and create rotarama db # This is done during installation on other platforms from libtbx.auto_build import installer_utils python_exe = os.path.join(self.dest_dir, 'base', 'bin', 'python', 'python.exe') # check for conda if self.base_dir == 'conda_base': python_exe = os.path.join(self.dest_dir, self.base_dir, 'python.exe') arg = [ python_exe, os.path.join(self.dest_dir, 'bin', 'install.py'), '--nopycompile' ] installer_utils.call(arg, cwd=self.dest_dir) print("Creating zip archive of distribution") fname = os.path.join(self.dist_dir, '%s.zip' % os.path.basename(self.dest_dir)) myzip = zipfile.ZipFile(fname, 'w', zipfile.ZIP_DEFLATED, allowZip64=True) for dirpath, dirs, files in os.walk(self.dest_dir): for f in files: fname = os.path.join(dirpath, f) relfname = os.path.relpath( fname, os.path.join(os.getcwd(), "tmp")) # Prepending \\?\ to path tells Windows to accept paths longer than 260 character if len(fname) >= 260: fname = "\\\\?\\" + fname if len(relfname) >= 260: relfname = "\\\\?\\" + relfname myzip.write(filename=fname, arcname=relfname) myzip.close() else: print("Creating tar archive of distribution") tar(os.path.basename(self.dest_dir), os.path.join(self.dist_dir, '%s.tar.gz' % os.path.basename(self.dest_dir)), cwd=os.path.join(self.dest_dir, '..'))
def reconfigure_as_libtbx_does(self, log): """ Run libtbx/configure.py to configure the build in the new location. This is copied from the cctbx_project/libtbx/auto_build/install_distribution.py, which does not allow customizing the call to configure. We want to customize to remove phenix dispatchers. """ os.chdir(self.build_dir) if "darwin" in sys.platform: base_python = os.path.join(self.base_dir, "python.app", "Contents", "MacOS", "python") elif "win32" in sys.platform: base_python = os.path.join(self.base_dir, "python.exe") else: base_python = os.path.join(self.base_dir, "bin", "python") if "win32" == sys.platform: args = [ base_python, os.path.join(self.modules_dir, "cctbx_project", "libtbx", "configure.py"), ] else: args = [ base_python, os.path.join(self.modules_dir, "cctbx_project", "libtbx", "configure.py"), "--current_working_directory", self.build_dir, ] args += ["--use_conda", "--skip_phenix_dispatchers"] args += self.configure_modules installer_utils.call(args=args, log=log, verbose=self.options.verbose)