def run(self): install_data.run(self) if not WINDOWS: self.source_bash_script() else: self.update_windows_registry()
def run(self): old_install_data.run(self) if have_setuptools: # Run install_clib again, since setuptools does not run sub-commands # of install automatically self.run_command("install_clib")
def run(self): if not os.path.exists('epydoc/index.html'): self.run_command('epydoc') self.data_files = [ (os.path.join(self.htmldir, 'api'), glob.glob('epydoc/*')), ] install_data.run(self)
def run(self): if not os.path.exists('doc/portage.html'): self.run_command('docbook') self.data_files = [ (self.htmldir, glob.glob('doc/*.html')), ] install_data.run(self)
def run (self): install_data.run(self) data_file = [("/etc/init.d/client",0755), ("/usr/share/calculate/xdm/wait_domain",0755)] fileNames = map(lambda x: os.path.split(x[0])[1], data_file) listNames = map(lambda x: filter(lambda y: y, x[0].split("/")),data_file) data_find = {} for i in range(len(fileNames)): listNames[i].reverse() data_find[fileNames[i]] =[listNames[i],data_file[i][1]] for path in self.get_outputs(): nameFile = os.path.split(path)[1] if nameFile in data_find.keys(): data = data_find[nameFile][0] mode = data_find[nameFile][1] flagFound = True iMax = len(data) pathFile = path for i in range(iMax): if data[i] != os.path.split(pathFile)[1]: flagFound = False break pathFile = os.path.split(pathFile)[0] if flagFound: os.chmod(path, mode)
def run(self): # Go through each "directory" entry. new_data_files = [] for data in self.data_files: # Skip over files not destined for man1 directories. if not isinstance(data, tuple) or data[0] != 'share/man/man1': new_data.append(data) continue # Go through the files, and look for *.rst pages. new_list = [] for entry in data[1]: # Only process *.rst files. if not entry.endswith('.rst'): new_list.append(entry) continue # Use docutils to convert the RST document to manpage 1 format. man = entry[:-4] + '.1' log.info("converting %s -> %s" % (entry, man)) publish_file(source_path=entry, destination_path=man, writer=manpage.Writer()) new_list.append(man) new_data_files.append((data[0], new_list)) # Pass the processed list to the original install_data.run() self.data_files = new_data_files install_data.run(self)
def run(self): locales = self.__locales('pyfpdb/locale') for (lang, loc, mo_file) in locales: lang_dir = os.path.join('share', 'locale', lang, loc) lang_file = os.path.join('pyfpdb/locale', lang, loc, mo_file) self.data_files.append( (lang_dir, [lang_file]) ) INST.run(self)
def run(self): install_data.run(self) if sys.platform.startswith("linux"): try: subprocess.call(["update-desktop-database"]) except: print("ERROR: unable to update desktop database", file=sys.stderr)
def run(self): # Call parent install_data.run(self) if glib_compile_schemas: # Execute commands after copying os.system('glib-compile-schemas %s/share/glib-2.0/schemas' % self.install_dir)
def run(self): # Generating and installing .mo files check_call('po/update-mo.sh') for langdir in glob('mo/*'): lang = os.path.basename(langdir) src = os.path.join(langdir, 'LC_MESSAGES', 'live-magic.mo') dst = os.path.join('share', 'locale', lang, 'LC_MESSAGES') self.data_files.append((dst, [src])) try: credits = file('misc/translator-credits.txt', 'w') for po in glob('po/*.po'): f = file(po) try: lang = os.path.basename(po).split('.')[0] for line in f: m = re.match(r'"Last-Translator: ([^\\]*)', line) if m: print >>credits, m.group(1), '(%s)' % lang break finally: f.close() finally: credits.close() install_data.run(self)
def run(self): print("COMPILING PO FILES") i18nfiles = [] if not os.path.isdir("src/openmolar/locale/"): print("WARNING - language files are missing!") for po_file in glob.glob("src/openmolar/locale/*.po"): directory, file_ = os.path.split(po_file) lang = file_.replace(".po", "") mo_dir = os.path.join(directory, lang) try: os.mkdir(mo_dir) except OSError: pass mo_file = os.path.join(mo_dir, "openmolar.mo") if not os.path.exists(mo_file) or newer(po_file, mo_file): cmd = 'msgfmt -o %s %s' % (mo_file, po_file) info('compiling %s -> %s' % (po_file, mo_file)) if os.system(cmd) != 0: info('Error while running msgfmt on %s' % po_file) destdir = os.path.join("/usr", "share", "locale", lang, "LC_MESSAGES") i18nfiles.append((destdir, [mo_file])) self.data_files.extend(i18nfiles) install_data.run(self)
def run(self): self.run_command('build_sphinx') self.data_files.remove('MARKER.txt') sphinx = self.get_finalized_command('build_sphinx') self.data_files += list(subtree('docs/html', os.path.join(sphinx.build_dir, 'html'))) install_data.run(self)
def run(self): for lang in os.listdir('garmon/locale'): if os.path.isdir(os.path.join('garmon/locale', lang)): lang_dir = os.path.join('share', 'locale', lang, 'LC_MESSAGES') lang_file = os.path.join('garmon/locale', lang, 'LC_MESSAGES', 'garmon.mo') #self.data_files.append( (lang_dir, [lang_file]) ) _install_data.run(self)
def run(self): install_data.run(self) # ensure there's a buildbot_worker/VERSION file fn = os.path.join(self.install_dir, 'buildbot_worker', 'VERSION') with open(fn, 'w') as f: f.write(version) self.outfiles.append(fn)
def run(self): for lang in os.listdir('build/locale/'): lang_dir = os.path.join('share', 'locale', lang, 'LC_MESSAGES') lang_file = os.path.join('build', 'locale', lang, 'LC_MESSAGES', 'arandr.mo') self.data_files.append((lang_dir, [lang_file])) _install_data.run(self)
def run(self): install_data.run(self) # Add secret key NEW_SECRET_KEY = ''.join([choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for i in range(50)]) root = self.root or '' with open('%s/etc/numeter/secret_key.txt' % root, 'w') as f: f.write(NEW_SECRET_KEY)
def run(self): name = self.distribution.get_name() for lang in os.listdir('build/locale/'): lang_dir = os.path.join('share', 'locale', lang, 'LC_MESSAGES') lang_file = os.path.join('build', 'locale', lang, 'LC_MESSAGES', name + '.mo') self.data_files.append( (lang_dir, [lang_file]) ) _install_data.run(self)
def run (self): install_data.run(self) data_file = \ [("/etc/init.d/sortmilter.init","sortmilter",0755), ("/etc/conf.d/sortmilter.conf","sortmilter",None)] data_find = \ dict( map(lambda x:(os.path.basename(x[0]), [list(reversed(filter(lambda y:y,x[0].split("/")))), x[1], x[2]]), data_file)) for path in self.get_outputs(): nameFile = os.path.split(path)[1] if nameFile in data_find.keys(): data = data_find[nameFile][0] newname = data_find[nameFile][1] mode = data_find[nameFile][2] flagFound = True iMax = len(data) pathFile = path for i in range(iMax): if data[i] != os.path.split(pathFile)[1]: flagFound = False break pathFile = os.path.split(pathFile)[0] if flagFound: if not mode is None: os.chmod(path, mode) if not newname is None: newname = os.path.join(os.path.dirname(path),newname) os.rename(path,newname)
def run(self): # install_data is a classic class so super() won't work. Call it # directly to copy the files first. _install_data.run(self) # Now gzip them for f in self.data_files: if type(f) is StringType: # it's a simple file f = convert_path(f) cmd = '/bin/gzip %s/%s' % (self.install_dir, f) log.info("gzipping %s/%s" % (self.install_dir, f)) os.system(cmd) else: # it's a tuple with path and a list of files dir = convert_path(f[0]) if not os.path.isabs(dir): dir = os.path.join(self.install_dir, dir) elif self.root: dir = change_root(self.root, dir) if f[1] == []: # If there are no files listed the user must be # trying to create an empty directory. So nothing # to do here. pass else: # gzip the files for data in f[1]: data = convert_path(data) cmd = '/bin/gzip %s/%s' % (dir, data) log.info("gzipping %s/%s" % (dir, data)) os.system(cmd)
def run(self): old_data_files = self.data_files self.data_files = [] for f in old_data_files: if isinstance(f, basestring): self.data_files.append(os.path.join( self.distribution.source_dir, f)) else: self.data_files.append( (f[0], [os.path.join(self.distribution.source_dir, fn) for fn in f[1]])) # Can we generate man pages? self.run_command('gen_doc_man') man_files = set() man_base = os.path.join(self.distribution.source_dir, self.distribution.netsa_doc_dir, "man") if os.path.exists(man_base): for man_dir in os.listdir(man_base): for man_page in os.listdir(os.path.join(man_base, man_dir)): man_files.add(os.path.join(man_dir, man_page)) self.data_files.append( (os.path.join("share", "man", man_dir), [os.path.join(man_base, man_dir, man_page)])) src_man = os.path.join(self.distribution.source_dir, man_base) if os.path.exists(src_man): for man_dir in os.listdir(src_man): for man_page in os.listdir(os.path.join(src_man, man_dir)): if os.path.join(man_dir, man_page) not in man_files: self.data_files.append( (os.path.join("share", "man", man_dir), [os.path.join(src_man, man_dir, man_page)])) install_data.run(self) self.data_files = old_data_files
def run (self): install_data.run(self) data_file = [] fileNames = map(lambda x: path.split(x[0])[1], data_file) listNames = map(lambda x: filter(lambda y: y, x[0].split("/")), data_file) data_find = {} for i in range(len(fileNames)): listNames[i].reverse() data_find[fileNames[i]] =[listNames[i],data_file[i][1]] for path in self.get_outputs(): nameFile = path.split(path)[1] if nameFile in data_find.keys(): data = data_find[nameFile][0] mode = data_find[nameFile][1] flagFound = True iMax = len(data) pathFile = path for i in range(iMax): if data[i] != path.split(pathFile)[1]: flagFound = False break pathFile = path.split(pathFile)[0] if flagFound: os.chmod(path, mode)
def run(self): """Execute install command""" subprocess.check_call(['make', '-C', 'doc']) install_data.run(self) # Old style base class # Create empty directories for directory in DIRECTORIES_TO_CREATE: if self.root: directory = change_root(self.root, directory) if not os.path.exists(directory): log.info("creating directory '%s'", directory) os.makedirs(directory) # Recursively overwrite directories for target, source in DIRECTORIES_TO_COPY: if self.root: target = change_root(self.root, target) if os.path.exists(target): remove_tree(target) log.info("recursive copy '%s' to '%s'", source, target) shutil.copytree(source, target, symlinks=True)
def run(self): # If there is an existing skins subdirectory, do not overwrite it. if os.path.exists(os.path.join(self.install_dir, 'skins')): # Do this by filtering it out of the list of subdirectories to be installed: self.data_files = filter(lambda dat : not dat[0].startswith('skins/'), self.data_files) # If the file #upstream.last exists, delete it, as it is no longer used. try: os.remove(os.path.join(self.install_dir, 'public_html/#upstream.last')) except: pass # If the file $WEEWX_INSTALL/readme.htm exists, delete it. It's # the old readme (since replaced with docs/readme.htm) try: os.remove(os.path.join(self.install_dir, 'readme.htm')) except: pass # Clean up after a bad install from earlier versions of setup.py: try: os.remove(os.path.join(self.install_dir, 'start_scripts/weewx')) except: pass # Run the superclass's run(): install_data.run(self)
def run (self): # remove /usr for bdist/bdist_rpm match = re.search('(build/[^/]+/dumb)/usr',self.install_dir) if match != None: self.install_dir = re.sub(match.group(0),match.group(1),self.install_dir) # remove /var/tmp/*-buildroot for bdist_rpm match = re.search('(/var/tmp/.*-buildroot)/usr',self.install_dir) if match != None: self.install_dir = re.sub(match.group(0),match.group(1),self.install_dir) # create tmp area tmpDir = 'build/tmp' self.mkpath(tmpDir) new_data_files = [] for destDir,dataFiles in self.data_files: newFilesList = [] for srcFile in dataFiles: # check extension if not srcFile.endswith('-template') and not self.is_expected_extension(srcFile): raise RuntimeError,"%s doesn't have the -template extension" % srcFile # dest filename destFile = re.sub('(\.exe)*\-template$','',srcFile) destFile = destFile.split('/')[-1] destFile = '%s/%s/%s' % (tmpDir,srcFile,destFile) # open src inFile = open(srcFile) # read filedata=inFile.read() # close inFile.close() # replace patterns if not self.is_expected_extension(srcFile): for item in re.findall('@@([^@]+)@@',filedata): if not hasattr(self,item) and not self.is_expected_extension(srcFile): raise RuntimeError,'unknown pattern %s in %s' % (item,srcFile) # get pattern patt = getattr(self,item) # remove build/*/dump for bdist patt = re.sub('build/[^/]+/dumb','',patt) # remove /var/tmp/*-buildroot for bdist_rpm patt = re.sub('/var/tmp/.*-buildroot','',patt) # replace filedata = filedata.replace('@@%s@@' % item, patt) # write to dest if not os.path.exists(os.path.dirname(destFile)): os.makedirs(os.path.dirname(destFile)) oFile = open(destFile,'w') oFile.write(filedata) oFile.close() # chmod for exe if srcFile.endswith('.exe-template'): commands.getoutput('chmod +x %s' % destFile) # append newFilesList.append(destFile) # replace dataFiles to install generated file new_data_files.append((destDir,newFilesList)) # install self.data_files = new_data_files install_data_org.run(self)
def run (self): def chmod_data_file (file): try: os.chmod (file, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) except: self.warn ("Could not chmod data file %s" % file) _install_data.run (self) map (chmod_data_file, self.get_outputs ())
def run(self): for lang in os.listdir('build/locale'): lang_dir = os.path.join(SITE_PACKAGES, 'palisades', 'i18n', 'locale', lang, 'LC_MESSAGES') lang_file = os.path.join('build', 'locale', lang, 'LC_MESSAGES', 'palisades.mo') self.data_files.append((lang_dir, [lang_file])) _install_data.run(self)
def run(self): print "**** locale listing: {}".format(os.listdir('OWDTestToolkit/locale')) for lang in os.listdir('OWDTestToolkit/locale'): print "**** install_data run LANG {}".format(lang) lang_dir = os.path.join('', 'locale', lang, 'LC_MESSAGES') lang_file = os.path.join('', 'locale', lang, 'LC_MESSAGES', 'default.mo') self.data_files.append((lang_dir, [lang_file])) _install_data.run(self)
def run(self): #from pprint import pprint #for self.data_files[0][1]) # Call parent for pod in pods: pod2man(pod) install_data.run(self)
def run(self): """Add built translation files and then install data files.""" self.data_files += [ (path.join(mo_install_prefix, lang, 'LC_MESSAGES'), [path.join(mo_build_prefix, lang, 'LC_MESSAGES', 'udiskie.mo')]) for lang in listdir(mo_build_prefix) ] orig_install_data.run(self)
def run(self): dataDir = self.install_dir if self.root: dataDir = dataDir[len(self.root) :] if dataDir.rstrip("/") in ("/usr/share", "/usr/local/share"): _install_data.run(self)
def run(self): install_cmd = self.get_finalized_command('install') self.install_dir = getattr(install_cmd, 'install_lib') return install_data.run(self)
def run (self): # remove /usr for bdist/bdist_rpm match = re.search('(build/[^/]+/dumb)/usr',self.install_dir) if match != None: self.install_dir = re.sub(match.group(0),match.group(1),self.install_dir) # remove /var/tmp/*-buildroot for bdist_rpm match = re.search('(/var/tmp/.*-buildroot)/usr',self.install_dir) if match != None: self.install_dir = re.sub(match.group(0),match.group(1),self.install_dir) # create tmp area tmpDir = 'build/tmp' self.mkpath(tmpDir) new_data_files = [] for destDir,dataFiles in self.data_files: newFilesList = [] for srcFile in dataFiles: # check extension if not srcFile.endswith('.template'): raise RuntimeError,"%s doesn't have the .template extension" % srcFile # dest filename destFile = re.sub('(\.exe)*\.template$','',srcFile) destFile = re.sub(r'^templates/','',destFile) destFile = '%s/%s' % (tmpDir,destFile) # open src inFile = open(srcFile) # read filedata=inFile.read() # close inFile.close() # replace patterns for item in re.findall('@@([^@]+)@@',filedata): if not hasattr(self,item): raise RuntimeError,'unknown pattern %s in %s' % (item,srcFile) # get pattern patt = getattr(self,item) # remove install root, if any if self.root is not None and patt.startswith(self.root): patt = patt[len(self.root):] # remove build/*/dump for bdist patt = re.sub('build/[^/]+/dumb','',patt) # remove /var/tmp/*-buildroot for bdist_rpm patt = re.sub('/var/tmp/.*-buildroot','',patt) # replace filedata = filedata.replace('@@%s@@' % item, patt) # write to dest if '/' in destFile: destSubDir = os.path.dirname(destFile) if not os.path.exists(destSubDir): os.makedirs(destSubDir) oFile = open(destFile,'w') oFile.write(filedata) oFile.close() # chmod for exe if srcFile.endswith('.exe.template'): commands.getoutput('chmod +x %s' % destFile) # append newFilesList.append(destFile) # replace dataFiles to install generated file new_data_files.append((destDir,newFilesList)) # install self.data_files = new_data_files install_data_org.run(self) #post install uid = pwd.getpwnam(panda_user).pw_uid gid = grp.getgrnam(panda_group).gr_gid for directory in ['/var/log/panda', '/var/log/panda/wsgisocks', '/var/log/panda/fastsocks']: if not os.path.exists(directory): os.makedirs(directory) os.chown(directory, uid, gid)
def run(self): install_data.run(self) self.install_app_config()
def run(self): self.data_files.extend(self._find_mo_files()) install_data.run(self)
def run(self): for f in 'mmgen.cfg', 'mnemonic.py', 'mn_wordlist.c': os.chmod(os.path.join('data_files', f), 0644) install_data.run(self)
def run(self): self.add_messages() _install_data.run(self)
def run(self): self.data_files.extend(self._find_css_files()) self.data_files.extend(self._find_mo_files()) install_data.run(self) if not self.distribution.without_icon_cache: self._update_icon_cache()
def run(self): install_data.run(self) # ensure there's a buildbot/VERSION file fn = os.path.join(self.install_dir, 'buildbot', 'VERSION') open(fn, 'w').write(version) self.outfiles.append(fn)
def run (self): self._add_locale_data() self._add_icon_data() install_data.run (self)
def run(self): #need to change self.install_dir to the actual library dir install_cmd = self.get_finalized_command('install') self.install_dir = getattr(install_cmd, 'install_lib') return install_data.run(self)
def run(self): #need to change self.install_dir to the library dir install_cmd = self.get_finalized_command('install') self.install_dir = getattr(install_cmd, 'install_lib') # should create the directory if it doesn't exist!!! return install_data.run(self)
def run(self): # remove /usr for bdist/bdist_rpm match = re.search('(build/[^/]+/dumb)/usr', self.install_dir) if match != None: self.install_dir = re.sub(match.group(0), match.group(1), self.install_dir) # remove /var/tmp/*-buildroot for bdist_rpm match = re.search('(/var/tmp/.*-buildroot)/usr', self.install_dir) if match != None: self.install_dir = re.sub(match.group(0), match.group(1), self.install_dir) # create tmp area tmpDir = 'build/tmp' self.mkpath(tmpDir) new_data_files = [] for destDir, dataFiles in self.data_files: newFilesList = [] for srcFile in dataFiles: # check extension if not srcFile.endswith( '-template') and not self.is_expected_extension( srcFile): raise RuntimeError, "%s doesn't have the -template extension" % srcFile # dest filename destFile = re.sub('(\.exe)*\-template$', '', srcFile) destFile = destFile.split('/')[-1] destFile = '%s/%s/%s' % (tmpDir, srcFile, destFile) # open src inFile = open(srcFile) # read filedata = inFile.read() # close inFile.close() # replace patterns if not self.is_expected_extension(srcFile): for item in re.findall('@@([^@]+)@@', filedata): if not hasattr( self, item) and not self.is_expected_extension( srcFile): raise RuntimeError, 'unknown pattern %s in %s' % ( item, srcFile) # get pattern patt = getattr(self, item) # remove build/*/dump for bdist patt = re.sub('build/[^/]+/dumb', '', patt) # remove /var/tmp/*-buildroot for bdist_rpm patt = re.sub('/var/tmp/.*-buildroot', '', patt) # replace filedata = filedata.replace('@@%s@@' % item, patt) # write to dest if not os.path.exists(os.path.dirname(destFile)): os.makedirs(os.path.dirname(destFile)) oFile = open(destFile, 'w') oFile.write(filedata) oFile.close() # chmod for exe if srcFile.endswith('.exe-template'): commands.getoutput('chmod +x %s' % destFile) # append newFilesList.append(destFile) # replace dataFiles to install generated file new_data_files.append((destDir, newFilesList)) # install self.data_files = new_data_files install_data_org.run(self)
def run(self): self.data_files.extend(self._compile_po_files()) install_data.run(self)
def run(self): # Set up paths to write to config file install_dir = self.install_dir install_logdir = '/var/log' if self.user or self.home: install_sysconfdir = os.path.join(install_dir, 'etc') elif os.name == 'posix' and install_dir in ('/', '/usr'): install_sysconfdir = '/etc' else: install_sysconfdir = 'scripts\\etc\\mysql' if not self.data_files: return # Go over all entries in data_files and process it if needed for df in self.data_files: # Figure out what the entry contain and collect a list of files. if isinstance(df, str): # This was just a file name, so it will be installed # in the install_dir location. This is a copy of the # behaviour inside distutils intall_data. directory = install_dir filenames = [df] else: directory = df[0] filenames = df[1] # Process all the files for the entry and build a list of # tuples (directory, file) data_files = [] for filename in filenames: # It was a config file template, add install # directories to the config file. if fnmatch.fnmatch(filename, 'data/*.cfg.in'): config = ConfigParser.RawConfigParser({ 'prefix': '', # custom install_dir, 'logdir': install_logdir, 'sysconfdir': install_sysconfdir, }) config.readfp(open(filename)) filename = os.path.splitext(filename)[0] config.write(open(filename, "w")) # change directory 'fabric'to mysql directory = os.path.join(install_sysconfdir, 'mysql') if os.name == 'nt': directory = install_sysconfdir data_files.append((directory, filename)) # Re-construct the data_files entry from what was provided by # merging all tuples with same directory and provide a list of # files as second item, e.g.: # [('foo', 1), ('bar', 2), ('foo', 3), ('foo', 4), ('bar', 5)] # --> [('bar', [2, 5]), ('foo', [1, 3, 4])] data_files.sort() data_files = [ (d, [f[1] for f in fs]) for d, fs in groupby(data_files, key=lambda x: x[0]) ] self.data_files = data_files log.info("package--> self.data_files {0}".format(self.data_files)) log.info("package.py--> self.data_files {0}".format(self.data_files)) _install_data.run(self)