def __init__(self, version, options): # create directories makedirs(PATH_DISTS) makedirs(PATH_LOG) if options.file is not None: if not (is_archive_file(options.file) and os.path.isfile(options.file)): logger.error('invalid file specified: %s' % options.file) raise RuntimeError self.download_url = path_to_fileurl(options.file) elif options.url is not None: if not is_url(options.url): logger.error('invalid URL specified: %s' % options.url) raise RuntimeError self.download_url = options.url else: if version not in self.supported_versions: logger.warning("Unsupported Python version: `%s`, trying with the following URL anyway: %s" % (version, self.get_version_url(version))) self.download_url = self.get_version_url(version) self.pkg = Package(version, options.type) self.install_dir = os.path.join(PATH_PYTHONS, self.pkg.name) self.build_dir = os.path.join(PATH_BUILD, self.pkg.name) filename = Link(self.download_url).filename self.download_file = os.path.join(PATH_DISTS, filename) self.options = options self.logfile = os.path.join(PATH_LOG, 'build.log') self.patches = [] self.configure_options = []
def validate_sha256(filename, sha256sum): if sha256sum is not None: return sha256(filename) == sha256sum else: logger.warning("sha256sum unavailable, skipping verification.\nMake " "sure that the server you're downloading from is trusted") return True
def get_version_url(cls, version): if sys.platform == 'darwin': return 'https://bitbucket.org/pypy/pypy/downloads/pypy3-%(version)s-osx64.tar.bz2' % {'version': version} else: # Linux logger.warning("Linux binaries are dynamically linked, as is usual, and thus might not be usable due to the sad story of linux binary compatibility, check the PyPy website for more information") arch = {4: '', 8: '64'}[ctypes.sizeof(ctypes.c_size_t)] return 'https://bitbucket.org/pypy/pypy/downloads/pypy3-%(version)s-linux%(arch)s.tar.bz2' % {'arch': arch, 'version': version}
def validate_sha256(filename, sha256sum): if sha256sum is not None: return sha256(filename) == sha256sum else: logger.warning( "sha256sum unavailable, skipping verification.\nMake " "sure that the server you're downloading from is trusted") return True
def __init__(self, version, options): # create directories makedirs(PATH_BUILD) makedirs(PATH_DISTS) makedirs(PATH_LOG) if options.file is not None: if not (is_archive_file(options.file) and os.path.isfile(options.file)): logger.error('invalid file specified: %s' % options.file) raise RuntimeError self.download_url = path_to_fileurl(options.file) elif options.url is not None: if not is_url(options.url): logger.error('invalid URL specified: %s' % options.url) raise RuntimeError self.download_url = options.url else: self.download_url = self.get_version_url(version) if version not in self.supported_versions: logger.warning( "Unsupported Python version: `%s`, trying with the following URL anyway: %s" % (version, self.download_url)) self.pkg = Package(version, options.type) if options.external_path: if not os.path.isabs(options.external_path): options.external_path = os.path.join( os.path.abspath(os.path.curdir), options.external_path) self.install_dir = os.path.join(options.external_path, self.pkg.name) else: self.install_dir = os.path.join(PATH_PYTHONS, self.pkg.name) self.build_dir = os.path.join(PATH_BUILD, self.pkg.name) filename = Link(self.download_url).filename self.download_file = os.path.join(PATH_DISTS, filename) # cleanup if os.path.isdir(self.build_dir): shutil.rmtree(self.build_dir) if os.path.isdir(self.install_dir): if options.reinstall: shutil.rmtree(self.install_dir) else: raise AlreadyInstalledError("You have already installed `%s`" % self.pkg.name) self.options = options self.logfile = os.path.join(PATH_LOG, 'build.log') self.patches = [] self.configure_options = []
def get_version_url(cls, version): if version >= '5.3': prefix = 'pypy2-v' else: prefix = 'pypy-' if sys.platform == 'darwin': url = '%s%s-osx64.tar.bz2' % (prefix, version) else: # Linux logger.warning("Linux binaries are dynamically linked, as is usual, and thus might not be usable due to the sad story of linux binary compatibility, check the PyPy website for more information") arch = {4: '', 8: '64'}[ctypes.sizeof(ctypes.c_size_t)] url = '%(prefix)s%(version)s-linux%(arch)s.tar.bz2' % {'arch': arch, 'prefix': prefix, 'version': version} return cls.base_url + url
def __init__(self, version, options): # create directories makedirs(PATH_BUILD) makedirs(PATH_DISTS) makedirs(PATH_LOG) if options.file is not None: if not (is_archive_file(options.file) and os.path.isfile(options.file)): logger.error('invalid file specified: %s' % options.file) raise RuntimeError self.download_url = path_to_fileurl(options.file) elif options.url is not None: if not is_url(options.url): logger.error('invalid URL specified: %s' % options.url) raise RuntimeError self.download_url = options.url else: self.download_url = self.get_version_url(version) if version not in self.supported_versions: logger.warning("Unsupported Python version: `%s`, trying with the following URL anyway: %s" % (version, self.download_url)) self.pkg = Package(version, options.type) if options.external_path: if not os.path.isabs(options.external_path): options.external_path = os.path.join( os.path.abspath(os.path.curdir), options.external_path) self.install_dir = os.path.join(options.external_path, self.pkg.name) else: self.install_dir = os.path.join(PATH_PYTHONS, self.pkg.name) self.build_dir = os.path.join(PATH_BUILD, self.pkg.name) filename = Link(self.download_url).filename self.download_file = os.path.join(PATH_DISTS, filename) # cleanup if os.path.isdir(self.build_dir): shutil.rmtree(self.build_dir) if os.path.isdir(self.install_dir): if options.reinstall: shutil.rmtree(self.install_dir) else: raise AlreadyInstalledError("You have already installed `%s`" % self.pkg.name) self.options = options self.logfile = os.path.join(PATH_LOG, 'build.log') self.patches = [] self.configure_options = []
def get_version_url(cls, version): if version >= '5.3': prefix = 'pypy2-v' else: prefix = 'pypy-' if sys.platform == 'darwin': url = '%s%s-osx64.tar.bz2' % (prefix, version) else: # Linux logger.warning( "Linux binaries are dynamically linked, as is usual, and thus might not be usable due to the sad story of linux binary compatibility, check the PyPy website for more information" ) arch = {4: '', 8: '64'}[ctypes.sizeof(ctypes.c_size_t)] url = '%(prefix)s%(version)s-linux%(arch)s.tar.bz2' % { 'arch': arch, 'prefix': prefix, 'version': version } return cls.base_url + url