def run_update(self, package_name, new_version, url=None): """ update: Update a package. This modifies the Sage sources. $ sage --package update pari 2015 --url=http://localhost/pari/tarball.tgz """ from sage_bootstrap.updater import PackageUpdater update = PackageUpdater(package_name, new_version) if url is not None: update.download_upstream(url) update.fix_checksum()
def update(self, package_name, new_version, url=None): """ Update a package. This modifies the Sage sources. $ sage --package update pari 2015 --url=http://localhost/pari/tarball.tgz """ log.debug('Updating %s to %s', package_name, new_version) update = PackageUpdater(package_name, new_version) if url is not None: log.debug('Downloading %s', url) update.download_upstream(url) update.fix_checksum()
def update(self): package = Package(self.name) if package.version == self.version: log.info('%s is already at the latest version', self.name) return log.info('Updating %s: %s -> %s', self.name, package.version, self.version) try: source_url = self.url except PyPiError as error: # Sometimes there is no source tarball listed for latest version log.info(error) else: update = PackageUpdater(self.name, self.version) update.download_upstream(source_url) update.fix_checksum()
def update(self): package = Package(self.name) if package.version == self.version: log.info('%s is already at the latest version', self.name) return log.info('Updating %s: %s -> %s', self.name, package.version, self.version) update = PackageUpdater(self.name, self.version) update.download_upstream(self.url) update.fix_checksum()
def create(self, package_name, version, tarball, pkg_type, upstream_url): log.debug('Creating %s: %s, %s, %s', package_name, version, tarball, pkg_type) creator = PackageCreator(package_name) if version: creator.set_version(version) if pkg_type: creator.set_type(pkg_type) if tarball: creator.set_tarball(tarball, upstream_url) if upstream_url and version: update = PackageUpdater(package_name, version) update.download_upstream() else: update = ChecksumUpdater(package_name) update.fix_checksum()
def update(self, package_name, new_version, url=None): """ Update a package. This modifies the Sage sources. $ sage --package update pari 2015 --url=http://localhost/pari/tarball.tgz """ log.debug('Updating %s to %s', package_name, new_version) update = PackageUpdater(package_name, new_version) if url is not None or update.package.tarball_upstream_url: log.debug('Downloading %s', url) update.download_upstream(url) update.fix_checksum()
def create(self, package_name, version=None, tarball=None, pkg_type=None, upstream_url=None, description=None, license=None, upstream_contact=None, pypi=False, source='normal'): """ Create a normal package """ if '-' in package_name: raise ValueError( 'package names must not contain dashes, use underscore instead' ) if pypi: pypi_version = PyPiVersion(package_name) if source == 'normal': if not tarball: # Guess the general format of the tarball name. tarball = pypi_version.tarball.replace( pypi_version.version, 'VERSION') if not version: version = pypi_version.version # Use a URL from pypi.io instead of the specific URL received from the PyPI query # because it follows a simple pattern. upstream_url = 'https://pypi.io/packages/source/{0:1.1}/{0}/{1}'.format( package_name, tarball) if not description: description = pypi_version.summary if not license: license = pypi_version.license if not upstream_contact: upstream_contact = pypi_version.package_url if tarball and not pkg_type: # If we set a tarball, also make sure to create a "type" file, # so that subsequent operations (downloading of tarballs) work. pkg_type = 'optional' log.debug('Creating %s: %s, %s, %s', package_name, version, tarball, pkg_type) creator = PackageCreator(package_name) if version: creator.set_version(version) if pkg_type: creator.set_type(pkg_type) if description or license or upstream_contact: creator.set_description(description, license, upstream_contact) if pypi or source == 'pip': creator.set_python_data_and_scripts( pypi_package_name=pypi_version.name, source=source) if tarball: creator.set_tarball(tarball, upstream_url) if upstream_url and version: update = PackageUpdater(package_name, version) update.download_upstream() else: update = ChecksumUpdater(package_name) update.fix_checksum()