def py3_compatibility_of_one_package(package_name): """ returns True if compatible, False if not, None if nothing is mentioned in the setup.py """ if not package_name: raise ValueError("No package name specified!") package_real_name = real_name(package_name) ret = { 'compatible': None, 'package_name': package_real_name or package_name } if not package_real_name: return ret pypi = PyPIXmlRpc() package_versions = pypi.package_releases(package_real_name) if not package_versions: return ret latest_version = package_versions[0] release = pypi.release_data(package_real_name, latest_version) # HACK: to avoid checking for 3.1, 3.2 etc, lets just str the classifiers # Original idea is from https://code.google.com/p/python3wos classifiers = str(release['classifiers']) ret['checked_version'] = latest_version if 'Programming Language :: Python :: 3' in classifiers: ret.update({'compatible': True}) return ret if 'Programming Language :: Python :: 2 :: Only' in classifiers: ret.update({'compatible': False}) return ret return ret
def __init__(self, req, pref=None): self.req = req self.req.name = self.name = real_name(self.req.name) if self.req.op == '==': ## LOL self.package_manager = PyPIJson(self.name, self.req.version) else: self.package_manager = PyPIJson(self.name, highest_version(self.req)) url = args_manager['install']['index_url'] + '/' + self.package_manager.URL.split('/pypi/', 1)[1] self.package_manager.URL = url self._set_prefs(pref) self.downloaded_name = None self.downloaded_version = None
def __init__(self, req, pref=None): self.req = req self.req.name = self.name = real_name(self.req.name) if self.req.op is None: self.package_manager = PyPIJson(self.name) elif self.req.op == '==': ## LOL self.package_manager = PyPIJson(self.name, self.req.version) else: self.package_manager = PyPIJson(self.name, highest_version(self.req)) url = args_manager['install']['packages_url'] if url.endswith('/simple'): self.package_manager.URL = url[:-6] + self.package_manager.URL.rsplit('/pypi/', 1)[1] self._set_prefs(pref) self.downloaded_name = None self.downloaded_version = None