def install(self): if not self.distribution.with_aeidon: return install_lib.install(self) get_command_obj = self.distribution.get_command_obj root = get_command_obj("install").root prefix = get_command_obj("install").install_data # Allow --root to be used like DESTDIR. if root is not None: prefix = os.path.abspath(prefix) prefix = prefix.replace(os.path.abspath(root), "") data_dir = os.path.join(prefix, "share", "gaupol") locale_dir = os.path.join(prefix, "share", "locale") # Write changes to the aeidon.paths module. path = os.path.join(self.build_dir, "aeidon", "paths.py") text = open(path, "r", encoding="utf_8").read() patt = r"^DATA_DIR = .*$" repl = "DATA_DIR = {!r}".format(data_dir) text = re.sub(patt, repl, text, flags=re.MULTILINE) assert text.count(repl) == 1 patt = r"^LOCALE_DIR = .*$" repl = "LOCALE_DIR = {!r}".format(locale_dir) text = re.sub(patt, repl, text, flags=re.MULTILINE) assert text.count(repl) == 1 open(path, "w", encoding="utf_8").write(text) return install_lib.install(self)
def install(self): outfiles = install_lib.install(self) for outfile in outfiles: if os.path.splitext(outfile)[1].lower() != '.py': print "setting mode 755 to %s" % outfile os.chmod(outfile, 0755) return outfile
def install(self): ret = install_lib.install(self) def rewrite_file(path, val_dict): path = os.path.join(self.install_dir, path) print('Rewriting %s' % path) with codecs.open(path, 'r', 'utf-8') as f: data = f.read() for varname, val in val_dict.items(): regexp = r'(?m)^(%s\s*=).*$' % varname repl = r'\1 %s' % repr(val) data = re.sub(regexp, repl, data) with codecs.open(path, 'w', 'utf-8') as f: f.write(data) rewrite_file('portage/__init__.py', { 'VERSION': self.distribution.get_version(), }) rewrite_file('portage/const.py', { 'PORTAGE_BASE_PATH': self.portage_base, 'PORTAGE_BIN_PATH': self.portage_bindir, 'PORTAGE_CONFIG_PATH': self.portage_confdir, }) return ret
def install(self): ret = install_lib.install(self) def rewrite_file(path, val_dict): path = os.path.join(self.install_dir, path) print('Rewriting %s' % path) with codecs.open(path, 'r', 'utf-8') as f: data = f.read() for varname, val in val_dict.items(): regexp = r'(?m)^(%s\s*=).*$' % varname repl = r'\1 %s' % repr(val) data = re.sub(regexp, repl, data) with codecs.open(path, 'w', 'utf-8') as f: f.write(data) rewrite_file('portage/__init__.py', { 'VERSION': self.distribution.get_version(), }) rewrite_file( 'portage/const.py', { 'PORTAGE_BASE_PATH': self.portage_base, 'PORTAGE_BIN_PATH': self.portage_bindir, 'PORTAGE_CONFIG_PATH': self.portage_confdir, }) return ret
def install(self): # let the distutils' install_lib do the hard work outfiles = _install_lib.install(self) # batch rename the outfiles: # for each file, match string between # second last and last dot and trim it matcher = re.compile('\.([^.]+)\.so$') for i, outfile in enumerate(outfiles): # NOTE that since Windows cannot link with an extention name like 'quickumls_simstring/_simstring' # we must work around an install-time issue to make sure that PYD libs still go to installdir/quickumls_simstring if '.pyd' in outfile.lower(): pyd_file = os.path.basename(outfile) # let's copy any .PYD files from the root into the installdir/quickumls_simstring source_path = os.path.join(self.build_dir, pyd_file) target_path = os.path.join(self.install_dir, 'quickumls_simstring', pyd_file) print('Manually copying a Windows PYD from {0} to {1}'.format( source_path, target_path)) shutil.copy(source_path, target_path) return [ batch_rename(file, re.sub(matcher, '.so', file)) for file in outfiles ]
def install(self): # copy the tesseract/leptonica DLL also self.copy_file( os.path.join(library_dirs[0], 'libtesseract302.dll'), self.build_dir) self.copy_file(os.path.join(library_dirs[0], 'liblept168.dll'), self.build_dir) return install_lib.install(self)
def install(self): # let the distutils' install_lib do the hard work outfiles = _install_lib.install(self) # batch rename the outfiles: # for each file, match string between # second last and last dot and trim it matcher = re.compile('\.([^.]+)\.so$') return [batch_rename(file, re.sub(matcher, '.so', file)) for file in outfiles]
def install(self): outfiles = _base.install(self) #distutils is used to install python modules, not c libraries #so it does not have a command to install c libs. #for a hack, we put installation of c libs here. if self.distribution.has_c_libraries(): build_clib = self.get_finalized_command('build_clib') self.install_clibs( build_clib.libraries ) return outfiles
def install(self): install = self.distribution.get_command_obj('install') installed_template = 'data_dir = "'+ os.path.join(install.prefix, 'share', 'khagan')+'"' filename = os.path.join(self.install_dir, 'khagan_globals.py') self.mkpath(os.path.dirname(filename)) fp = open(filename, 'w') fp.write(installed_template) fp.close() return install_lib.install(self) + [filename]
def install(self): """ Copy build_dir to install_dir """ # A Hack to unlink liborange.so -> orange.so if it already exists, # because copy_tree fails to overwrite it # liborange = os.path.join(self.install_dir, "Orange", "liborange.so") if self.force and os.path.exists(liborange) and os.path.islink(liborange): log.info("unlinking %s -> %s", liborange, os.path.join(self.install_dir, "orange.so")) os.unlink(liborange) return install_lib.install(self)
def install(self): #need to change self.install_dir to the library dir outfiles = install_lib.install(self) for f in outfiles: if f.endswith("get.py"): if os.name == 'posix': # Set the executable bits (owner, group, and world) on # the script we just installed. mode = ((os.stat(f)[stat.ST_MODE]) | 0o555) & 0o7777 print("changing mode of %s to %o" % (f, mode)) os.chmod(f, mode) return outfiles
def install(self): # The build is done here, now we have to adapt it to current platform # before installing. self.adapt_build_to_platform() # Let the original method do the hard work of copying the files. outfiles = old_install_lib.install(self) # Also byte_compile for distribution usage. if outfiles is not None: self.byte_compile(outfiles) return outfiles
def install(self): #need to change self.install_dir to the library dir outfiles = install_lib.install(self) for f in outfiles: if f.endswith("get.py"): if os.name == 'posix': # Set the executable bits (owner, group, and world) on # the script we just installed. mode = ((os.stat(f)[stat.ST_MODE]) | 0555) & 07777 print "changing mode of %s to %o" % (f, mode) os.chmod(f, mode) return outfiles
def install(self): outfiles = _install_lib.install(self) extra = [] for of in outfiles: if os.path.basename(of) == "amqp-0-10-qpid-errata-stripped.xml": tgt = pclfile(of) if self.force or newer(of, tgt): log.info("caching %s to %s" % (of, os.path.basename(tgt))) if not self.dry_run: from qpid.ops import load_types load_types(of) extra.append(tgt) return outfiles + extra
def install(self): """ Copy build_dir to install_dir """ # Unlink liborange.so -> orange.so if it already exists, # because copy_tree fails to overwrite it liborange = os.path.join(self.install_dir, "Orange", "liborange.so") if os.path.islink(liborange): log.info("unlinking %s -> %s", liborange, os.path.join(self.install_dir, "orange.so")) if not self.dry_run: os.unlink(liborange) return install_lib.install(self)
def install(self): """ Copy build_dir to install_dir """ # A Hack to unlink liborange.so -> orange.so if it already exists, # because copy_tree fails to overwrite it # liborange = os.path.join(self.install_dir, "Orange", "liborange.so") if self.force and os.path.exists(liborange) and os.path.islink( liborange): log.info("unlinking %s -> %s", liborange, os.path.join(self.install_dir, "orange.so")) os.unlink(liborange) return install_lib.install(self)
def install(self): #overwrite to chmod modules before moving them #code copied from distutils install_scripts import os from stat import ST_MODE from distutils import log outfiles = _install_lib.install(self) if os.name == 'posix': # Set the executable bits (owner, group, and world) on # all the scripts we just installed. for file in outfiles: if self.dry_run: log.info("changing mode of %s", file) else: mode = ((os.stat(file)[ST_MODE]) | 0555) & 07777 log.info("changing mode of %s to %o", file, mode) os.chmod(file, mode)
def install(self): retval = _install_lib.install(self) if retval is None: return retval py2exe_obj = self.distribution.get_command_obj('py2exe', False) if (py2exe_obj is None) and (self.distinfo_package is not None): parts = [self.install_dir] parts.extend(self.distinfo_package) parts.append('%s.py' % self.distinfo_module) installed_module_path = os.path.join(*parts) install_obj = self.get_finalized_command('install') install_data_obj = self.get_finalized_command('install_data') distinfo = [ ( 'install_base', self._prepare_distinfo_string( os.path.abspath(install_obj.install_base, )), ), ( 'install_platbase', self._prepare_distinfo_string( os.path.abspath(install_obj.install_platbase, )), ), ( 'install_purelib', self._prepare_distinfo_string( os.path.abspath(install_obj.install_purelib, )), ), ( 'install_platlib', self._prepare_distinfo_string( os.path.abspath(install_obj.install_platlib, )), ), ( 'install_lib', self._prepare_distinfo_string( os.path.abspath(install_obj.install_lib, )), ), ( 'install_headers', self._prepare_distinfo_string( os.path.abspath(install_obj.install_headers, )), ), ( 'install_scripts', self._prepare_distinfo_string( os.path.abspath(install_obj.install_scripts, )), ), ( 'install_data', self._prepare_distinfo_string( os.path.abspath(install_data_obj.install_dir, )), ), ( 'install_data_arch', self._prepare_distinfo_string( os.path.abspath(install_data_obj.install_dir_arch, )), ), ( 'install_data_arch_pkg', self._prepare_distinfo_string( os.path.abspath( install_data_obj.install_dir_arch_pkg, )), ), ( 'install_data_indep', self._prepare_distinfo_string( os.path.abspath(install_data_obj.install_dir_indep, )), ), ( 'install_data_indep_pkg', self._prepare_distinfo_string( os.path.abspath( install_data_obj.install_dir_indep_pkg, )), ), ] self._write_distinfo_module(installed_module_path, distinfo) retval.append(installed_module_path) return retval
def install(self): template = self.generate_template() return install_lib.install(self) + [template]
def install(self): # copy the custom sip module to the build directory so it gets # picked up by the bdist_wininst :) import pynetworktables_sip self.copy_file(pynetworktables_sip.__file__, self.build_dir) return install_lib.install(self)
def install(self): # copy the tesseract/leptonica DLL also self.copy_file(os.path.join(library_dirs[0], 'libtesseract302.dll'), self.build_dir) self.copy_file(os.path.join(library_dirs[0], 'liblept168.dll'), self.build_dir) return install_lib.install(self)
def install(self): self.varext = _VariableExtender(self.distribution) return install_lib.install(self) + [self.generate_template()]
def install(self): install_lib.install(self) ks_install_dir = os.path.join(self.install_dir, 'keystone') for lib_file in SETUP_DATA_FILES: file_util.copy_file(lib_file, ks_install_dir)
def install(self): self.varext = _VariableExtender(self.distribution) return (install_lib.install(self) or []) + [self.generate_template()]
def install(self): ret = install_lib.install(self) def rewrite_file(path, val_dict): path = os.path.join(self.install_dir, path) print('Rewriting %s' % path) with codecs.open(path, 'r', 'utf-8') as f: data = f.read() for varname, val in val_dict.items(): regexp = r'(?m)^(%s\s*=).*$' % varname repl = r'\1 %s' % repr(val) data = re.sub(regexp, repl, data) with codecs.open(path, 'w', 'utf-8') as f: f.write(data) rewrite_file('portage/__init__.py', { 'VERSION': self.distribution.get_version(), }) def re_sub_file(path, pattern_repl_items): path = os.path.join(self.install_dir, path) print("Rewriting %s" % path) with codecs.open(path, "r", "utf-8") as f: data = f.read() for pattern, repl in pattern_repl_items: data = re.sub(pattern, repl, data, flags=re.MULTILINE) with codecs.open(path, "w", "utf-8") as f: f.write(data) val_dict = {} if create_entry_points: val_dict.update( { "GLOBAL_CONFIG_PATH": self.portage_confdir, } ) re_sub_file( "portage/const.py", ( ( r"^(PORTAGE_BASE_PATH\s*=\s*)(.*)", lambda m: "{}{}".format( m.group(1), 'os.path.realpath(os.path.join(__file__, "../../usr/lib/portage"))', ), ), ( r"^(EPREFIX\s*=\s*)(.*)", lambda m: "{}{}".format( m.group(1), 'os.path.realpath(os.path.join(__file__, "../.."))', ), ), ), ) else: val_dict.update( { "PORTAGE_BASE_PATH": self.portage_base, "PORTAGE_BIN_PATH": self.portage_bindir, } ) rewrite_file("portage/const.py", val_dict) return ret
def install(self): outfiles = install_lib.install(self) self.set_file_modes(outfiles, 0o644, 0o755) self.set_dir_modes(self.install_dir, 0o755) return outfiles