Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def to_nix_dict(egg, nixname):
"""Return a dict of the package attributes relevant to a nix
expression
"""
pypi = Crawler()
name = egg['name']
if egg['extras']:
name += '-'.join(egg['extras'])
name += '-' + egg['version']
version = suggest_normalized_version(egg['version'])
egg_release = pypi.get_release(egg['name'] + '==' + version)
egg_dist = egg_release.dists['sdist'].url
url = egg_dist['url']
url = url.replace("http://a.pypi", "http://pypi")
url = url.replace(name, "${name}")
build_inputs = ''
if url.endswith(".zip"):
build_inputs = "\n buildInputs = [ pkgs.unzip ];\n"
An index can be specified using -i or --index-url followed by an address.
You can specify -v or --version followed by a specific version number and
search will return the closest match.
In the future it will be changed to an expression so instead of returning a single
match, it will return multiple and you can use an expression like >0.6.3,!=0.8.3,<=1.0.2
to get all versions greater then 0.6.3 not 0.8.3 and all less then or equal to 1.0.2
"""
#search returns a ReleasesList which is a list of ReleaseInfo's
from distutils2.pypi.dist import ReleasesList, ReleaseInfo
from distutils2.pypi.simple import Crawler
#no index specified, use standard
if not args.index_url:
crawler = Crawler()
#use custom index
else:
if isinstance(args.index_url, str):
crawler = Crawler(index_url = args.index_url)
else:
print('--index-url must be a string')
return
print("Recieved {0}".format(args))
print("---------- Search Results ----------")
#search!
if not args.version:
releaseList = crawler.get_releases(args.package_name)
releaseList.sort_releases(reverse = False)
In the future it will be changed to an expression so instead of returning a single
match, it will return multiple and you can use an expression like >0.6.3,!=0.8.3,<=1.0.2
to get all versions greater then 0.6.3 not 0.8.3 and all less then or equal to 1.0.2
"""
#search returns a ReleasesList which is a list of ReleaseInfo's
from distutils2.pypi.dist import ReleasesList, ReleaseInfo
from distutils2.pypi.simple import Crawler
#no index specified, use standard
if not args.index_url:
crawler = Crawler()
#use custom index
else:
if isinstance(args.index_url, str):
crawler = Crawler(index_url = args.index_url)
else:
print('--index-url must be a string')
return
print("Recieved {0}".format(args))
print("---------- Search Results ----------")
#search!
if not args.version:
releaseList = crawler.get_releases(args.package_name)
releaseList.sort_releases(reverse = False)
#display the results!
for release in releaseList:
print('\nName : {0}'.format(release.name))
print('Version: {0}'.format(release.version))
#ignore_packages = ['plone_recipe_zope2instance',]
ignore_packages = []
install_command = """
# ignore dependencies
installCommand = ''
easy_install --always-unzip --no-deps --prefix="$out" .
'';
"""
plonedeps = open("plonedeps", "r").read()
if __name__ == '__main__':
#eggs = to_dict(sys.stdin.read())
eggs = to_dict(plonedeps)
pypi = Crawler()
bad_eggs = []
not_found = []
version_error = []
print PRE_TMPL
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: