Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
eggs = to_dict(args.input.read())
nix_write = args.output.write
nix_write(PRE_TMPL)
not_found = []
version_error = []
for nixname in sorted(eggs.keys()):
if nixname in SYSTEM_PACKAGES: continue
if nixname in IGNORE_PACKAGES: continue
egg = eggs[nixname]
try:
args.output.write(TMPL % to_nix_dict(egg, nixname))
except ProjectNotFound:
not_found.append(egg['name'])
except IrrationalVersionError:
version_error.append(egg['name'])
nix_write(POST_TMPL)
nix_write(
"# Not Found: {0}\n# Version Error: {1}".format(
not_found, version_error)
)
for nixname in sorted(eggs.keys()):
if nixname in system_packages: continue
if nixname in ignore_packages: continue
egg = eggs[nixname]
version = suggest_normalized_version(egg['version'])
name = egg['name']
if egg['extras']:
name += '-'.join(egg['extras'])
name += '-' + egg['version']
if version is None:
version = ''
try:
egg_release = pypi.get_release(egg['name'] + '==' + egg['version'])
except ProjectNotFound:
not_found.append(egg['name'])
except IrrationalVersionError:
version_error.append(egg['name'])
egg_dist = egg_release.dists['sdist'].url
url = egg_dist['url']
url = url.replace("http://a.pypi", "http://pypi")
#metadata = nix_metadata(egg_release)
metadata = ''
url = url.replace(name, "${name}")
build_inputs = ''
if url.endswith(".zip"):
build_inputs = "\n buildInputs = [ pkgs.unzip ];\n"
propagated_build_inputs = ''
if nixname in hard_requirements.keys():
propagated_build_inputs = (
"\n propagatedBuildInputs = [ {0} ];\n"
).format(hard_requirements[nixname])
print TMPL % {'nixname': nixname,