def check(requirements_paths=[], metadata=[], projects=[]): """Return True if all of the specified dependencies have been ported to Python 3. The requirements_paths argument takes a sequence of file paths to requirements files. The 'metadata' argument takes a sequence of strings representing metadata. The 'projects' argument takes a sequence of project names. Any project that is not listed on PyPI will be considered ported. """ dependencies = [] dependencies.extend(main.projects_from_requirements(requirements_paths)) dependencies.extend(main.projects_from_metadata(metadata)) dependencies.extend(projects) manual_overrides = pypi.manual_overrides() for dependency in dependencies: if dependency in manual_overrides: continue elif not pypi.supports_py3(dependency): return False return True
def test_supports_py3(self): self.assertTrue(pypi.supports_py3({'name': "caniusepython3"})) self.assertFalse(pypi.supports_py3({'name': "pil"})) # Unfound projects are considered ported. self.assertTrue( pypi.supports_py3({'name': "sdfffavsafasvvavfdvavfavf"}))
if 'github.com' in app['url']: name = app['url'].split('github.com/')[1].split('/')[1] elif 'readthedocs.org' in app['url']: name = app['url'].split('.readthedocs.org')[0].replace('http://', '') if name in PYPI_NAMES_OVERRIDES: name = PYPI_NAMES_OVERRIDES[name] return name if __name__ == '__main__': r = requests.get( 'https://springload.github.io/awesome-wagtail/api/v1/readme.json') payload = json.loads(r.text) apps = payload['apps'] for app in apps: app['pypi_package_name'] = parse_pypi_package_name(app) if app['pypi_package_name']: app['supports_py3'] = supports_py3(app['pypi_package_name']) else: app['supports_py3'] = False with codecs.open('./src/data.js', 'w', 'utf-8') as file: file.write("export default %s;" % json.dumps({ 'apps': apps, }, indent=True))
def supports_py3(project_name): if project_name in overrides: return True else: return pypi.supports_py3(project_name)
def supports_py3(project): if project['name'] in overrides: return True else: return pypi.supports_py3(project, keep_version)
def test_supports_py3(self): self.assertTrue(pypi.supports_py3("caniusepython3")) self.assertFalse(pypi.supports_py3("pil")) # Unfound projects are considered ported. self.assertTrue(pypi.supports_py3("sdfffavsafasvvavfdvavfavf"))