def run(self): clean.run(self) if self.sources: if os.path.exists('src'): remove_tree('src', dry_run=self.dry_run) else: log.info("'%s' does not exist -- can't clean it", 'src')
def run(self): # generate spec file specfile = '{}.spec'.format(self.distribution.get_name()) if not reuse_dist_file(specfile): self.distribution.have_run.pop('bdist_rpm', None) speccmd = self.distribution.get_command_obj('bdist_rpm') self.distribution._set_command_options(speccmd, { 'spec_only': ('sdist', True), }) self.run_command('bdist_rpm') shutil.move(os.path.join('dist', specfile), specfile) log.info('moved {} to {}'.format(os.path.join('dist', specfile), specfile)) # generate debian/changelog debianchlog = os.path.join('debian', 'changelog') if not reuse_dist_file(debianchlog): self.distribution.have_run.pop('changelog') changelogcmd = self.distribution.get_command_obj('changelog') self.distribution._set_command_options(changelogcmd, { 'format': ('sdist', 'deb'), 'output': ('sdist', debianchlog), }) self.run_command('changelog') orig_sdist.run(self)
def run(self): if self.all: # remove dist if os.path.exists('dist'): remove_tree('dist') else: log.warn("'dist' does not exist -- can't clean it") # remove docs sphinx_dir = os.path.join(self.build_base, 'sphinx') if os.path.exists(sphinx_dir): remove_tree(sphinx_dir, dry_run=self.dry_run) else: log.warn("%r does not exist -- can't clean it", sphinx_dir) # remove setup eggs for egg in glob.glob('*.egg') + glob.glob('*.egg-info'): if os.path.isdir(egg): remove_tree(egg, dry_run=self.dry_run) else: log.info('removing %r' % egg) os.unlink(egg) # remove Portfile portfile = 'Portfile' if os.path.exists(portfile) and not self.dry_run: log.info('removing %r' % portfile) os.unlink(portfile) clean.run(self)
def run(self): # generate spec file specfile = '{}.spec'.format(self.distribution.get_name()) if not reuse_dist_file(specfile): self.distribution.have_run.pop('bdist_rpm', None) speccmd = self.distribution.get_command_obj('bdist_rpm') self.distribution._set_command_options(speccmd, { 'spec_only': ('sdist', True), }) self.run_command('bdist_rpm') shutil.move(os.path.join('dist', specfile), specfile) log.info('moved {} to {}'.format( os.path.join('dist', specfile), specfile)) # generate debian/changelog debianchlog = os.path.join('debian', 'changelog') if not reuse_dist_file(debianchlog): self.distribution.have_run.pop('changelog') changelogcmd = self.distribution.get_command_obj('changelog') self.distribution._set_command_options(changelogcmd, { 'format': ('sdist', 'deb'), 'output': ('sdist', debianchlog), }) self.run_command('changelog') orig_sdist.run(self)
def run(self): if self.all: # remove dist if os.path.exists('dist'): remove_tree('dist') else: log.warn("'dist' does not exist -- can't clean it") # remove docs sphinx_dir = os.path.join(self.build_base, 'sphinx') if os.path.exists(sphinx_dir): remove_tree(sphinx_dir, dry_run=self.dry_run) else: log.warn("%r does not exist -- can't clean it", sphinx_dir) # remove setup eggs for egg in glob.glob('*.egg') + glob.glob('*.egg-info'): if os.path.isdir(egg): remove_tree(egg, dry_run=self.dry_run) else: log.info('removing %r' % egg) os.unlink(egg) # remove extra files for filep in ('Portfile', ): if os.path.exists(filep) and not self.dry_run: log.info('removing %r' % filep) os.unlink(filep) orig_clean.run(self)
def _download(name, version, targetdir): from pip.commands.download import DownloadCommand dcmd = DownloadCommand() rset = dcmd.run(*dcmd.parse_args([ '{}=={}'.format(name, version), '--dest', targetdir, '--no-deps', '--no-binary', ':all:', ])) log.info('downloaded {}'.format( rset.requirements[name].link.url_without_fragment)) return os.path.join( targetdir, rset.requirements[name].link.filename)
def run(self): log.info('creating changelog') lines = [] for tag in self.get_git_tags(): if self.start_tag and self._tag_version(tag) < self.start_tag: log.debug('reached start tag ({}), stopping'.format( self.start_tag)) break lines.append(self.format_changelog_entry(tag)) log.info('writing changelog to {}'.format(self.output)) with open(self.output, 'w') as f: for line in lines: print(line, file=f)
def run(self): # get version from distribution if self.version is None: self.version = __version__ # find dist file dist = os.path.join( 'dist', '%s-%s.tar.gz' % (self.distribution.get_name(), self.distribution.get_version())) # run sdist if needed if not os.path.isfile(dist): self.run_command('sdist') # get checksum digests log.info('reading distribution tarball %r' % dist) with open(dist, 'rb') as fobj: data = fobj.read() log.info('recovered digests:') digest = dict() digest['rmd160'] = self._get_rmd160(dist) for algo in [1, 256]: digest['sha%d' % algo] = self._get_sha(data, algo) for key, val in digest.iteritems(): log.info(' %s: %s' % (key, val)) # write finished portfile to file with open(self.portfile, 'w') as fport: fport.write(self._template.render( version=self.distribution.get_version(), **digest)) log.info('portfile written to %r' % self.portfile)
def run(self): with temp_directory() as tmpd: # download dist file if self.tarball is None: self.tarball = self._download(self.distribution.get_name(), self.version, tmpd) # get checksum digests log.info('reading distribution tarball %r' % self.tarball) with open(self.tarball, 'rb') as fobj: data = fobj.read() log.info('recovered checksums:') checksum = dict() checksum['rmd160'] = self._get_rmd160(self.tarball) checksum['sha256'] = self._get_sha(data) checksum['size'] = os.path.getsize(self.tarball) for key, val in checksum.iteritems(): log.info(' %s: %s' % (key, val)) # write finished portfile to file with open(self.portfile, 'w') as fport: print(self._template.render( version=self.version, **checksum), file=fport) log.info('portfile written to %r' % self.portfile)
def run(self): super().run() if self.inplace: for p in ("PyBoy.egg-info", "build", "dist"): if os.path.isdir(p): shutil.rmtree(p) for root, dirs, files in os.walk(ROOT_DIR): if "__pycache__" in dirs: log.info(f"removing: {os.path.join(root, '__pycache__')}") remove_tree(os.path.join(root, "__pycache__")) for f in files: if os.path.splitext(f)[1] in (".pyo", ".pyc", ".pyd", ".so", ".c", ".h", ".dll", ".lib", ".exp", ".html"): print(f"removing: {os.path.join(root, f)}") os.remove(os.path.join(root, f))
def run(self): log.info('creating changelog') lines = [] tags = self.get_git_tags() if not self.is_tag(): version = self._tag_version(tags[0]).version devversion = '{0}.{1}.{2}-dev'.format(version[0], version[1], version[2]) lines.append(self.format_changelog_entry(devversion)) for tag in tags: if self.start_tag and self._tag_version(tag) < self.start_tag: log.debug('reached start tag ({}), stopping'.format( self.start_tag)) break lines.append(self.format_changelog_entry(tag)) log.info('writing changelog to {}'.format(self.output)) with open(self.output, 'w') as f: for line in lines: print(line, file=f)