Ejemplo n.º 1
0
 def __init__(self, *args, **kwargs):
     requirement = kwargs.pop('requirement', None)
     super(PackageVersion, self).__init__(*args, **kwargs)
     if requirement is None:
         return
     self.raw = requirement.line
     self.package_name = requirement.name
     self.is_editable = requirement.editable
     if requirement.editable:
         self.url = ''
         self.current_version = None
     else:
         # HACK: we only take the first version.
         self.current_version = Version.coerce(requirement.specs[0][1])
         self.url = pypi.package_url(requirement.name)
Ejemplo n.º 2
0
 def __init__(self, *args, **kwargs):
     requirement = kwargs.pop('requirement', None)
     super(PackageVersion, self).__init__(*args, **kwargs)
     if requirement is None:
         return
     self.raw = requirement.line
     self.package_name = requirement.name
     self.is_editable = requirement.editable
     if requirement.editable:
         self.url = ''
         self.current_version = None
     else:
         # HACK: we only take the first version.
         try:
             self.current_version = Version.coerce(requirement.specs[0][1])
             self.is_parseable = True
         except ValueError as ex:
             self.current_version = None
             self.is_parseable = False
             logger.debug("Unparseable package version (%s): %s",
                          requirement.specs[0][1], ex)
         self.url = pypi.package_url(requirement.name)
Ejemplo n.º 3
0
 def test_url(self):
     self.assertEqual(self.package.url, pypi.package_url('django'))
Ejemplo n.º 4
0
 def test_package_url(self):
     self.assertEqual(pypi.package_url('django'),
                      u"http://pypi.python.org/pypi/django/json")
 def test_package_url(self):
     self.assertEqual(pypi.package_url("django"),
                      "https://pypi.python.org/pypi/django/json")