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 __init__(self, arg, options): version = arg 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 = get_python_version_url(options.type, version) if not self.download_url: logger.error("Unknown python version: `%s`" % version) raise UnknownVersionException filename = Link(self.download_url).filename 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) self.download_file = os.path.join(PATH_DISTS, filename) self.options = options self.logfile = os.path.join(PATH_LOG, 'build.log') self.patches = [] if self.pkg.type in ('cpython', 'stackless') and Version(self.pkg.version) >= '3.1': self.configure_options = ['--with-computed-gotos'] else: self.configure_options = []
def __init__(self, version, options): 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.error("Unsupported Python version: `%s`, you may install it anyway by supplying the download or file URL" % version) raise UnknownVersionException 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 __init__(self, version, options): 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.error( "Unsupported Python version: `%s`, you may install it anyway by supplying the download or file URL" % version) raise UnknownVersionException 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 __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 __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 = []