Example #1
0
 def test_json(self):
     locator = PyPIJSONLocator(PYPI_RPC_HOST)
     result = locator.get_project('sarge')
     self.assertIn('0.1.1', result)
     dist = result['0.1.1']
     self.assertEqual(dist.name, 'sarge')
     self.assertEqual(dist.version, '0.1.1')
     self.assertEqual(dist.source_url,
                      'https://pypi.python.org/packages/source/s/sarge/'
                      'sarge-0.1.1.tar.gz')
     self.assertEqual(dist.digest,
                      ('md5', '2a9b9d46e4ef6ae51e2a5ff7de93d9dd'))
     self.assertRaises(NotImplementedError, locator.get_distribution_names)
Example #2
0
 def test_json(self):
     locator = PyPIJSONLocator(PYPI_RPC_HOST)
     result = locator.get_project('sarge')
     self.assertIn('0.1', result)
     dist = result['0.1']
     self.assertEqual(dist.name, 'sarge')
     self.assertEqual(dist.version, '0.1')
     self.assertEqual(dist.download_url,
                      'https://pypi.python.org/packages/source/s/sarge/'
                      'sarge-0.1.tar.gz')
     self.assertEqual(dist.md5_digest,
                      '961ddd9bc085fdd8b248c6dd96ceb1c8')
     self.assertRaises(NotImplementedError, locator.get_distribution_names)
Example #3
0
 def test_json(self):
     locator = PyPIJSONLocator(PYPI_RPC_HOST)
     result = locator.get_project("sarge")
     LATEST_SARGE_VERSION = "0.1.4"
     LATEST_SARGE_MD5 = "285013875aa908ef1417055d3e74a00a"
     self.assertIn(LATEST_SARGE_VERSION, result)
     dist = result[LATEST_SARGE_VERSION]
     self.assertEqual(dist.name, "sarge")
     self.assertEqual(dist.version, LATEST_SARGE_VERSION)
     path = "/sarge-%s.tar.gz" % LATEST_SARGE_VERSION
     for url in dist.download_urls:
         self.assertTrue(url.endswith(path))
     self.assertEqual(dist.digests[url], ("md5", LATEST_SARGE_MD5))
     self.assertRaises(NotImplementedError, locator.get_distribution_names)
Example #4
0
 def test_json(self):
     locator = PyPIJSONLocator(PYPI_RPC_HOST)
     result = locator.get_project('sarge')
     LATEST_SARGE_VERSION = '0.1.4'
     LATEST_SARGE_MD5 = '285013875aa908ef1417055d3e74a00a'
     self.assertIn(LATEST_SARGE_VERSION, result)
     dist = result[LATEST_SARGE_VERSION]
     self.assertEqual(dist.name, 'sarge')
     self.assertEqual(dist.version, LATEST_SARGE_VERSION)
     url = ('https://pypi.python.org/packages/source/s/sarge/'
            'sarge-%s.tar.gz' % LATEST_SARGE_VERSION)
     self.assertIn(url, dist.download_urls)
     self.assertEqual(dist.digests[url],('md5', LATEST_SARGE_MD5))
     self.assertRaises(NotImplementedError, locator.get_distribution_names)
Example #5
0
 def test_unicode_project_name(self):
     # Just checking to see that no exceptions are raised.
     NAME = '\u2603'
     locator = SimpleScrapingLocator('https://pypi.org/simple/')
     result = locator.get_project(NAME)
     expected = {'urls': {}, 'digests': {}}
     self.assertEqual(result, expected)
     locator = PyPIJSONLocator('https://pypi.org/pypi/')
     result = locator.get_project(NAME)
     self.assertEqual(result, expected)
Example #6
0
 def test_json(self):
     locator = PyPIJSONLocator(PYPI_RPC_HOST)
     result = locator.get_project('sarge')
     LATEST_SARGE_VERSION = '0.1.4'
     LATEST_SARGE_HASHES = (
         ('md5', '285013875aa908ef1417055d3e74a00a'),
         ('sha256',
          '59f93216723ddd9062d17cbbb90ed9e69267b84825cf0bde0b7f8d934c424823'
          ),
     )
     self.assertIn(LATEST_SARGE_VERSION, result)
     dist = result[LATEST_SARGE_VERSION]
     self.assertEqual(dist.name, 'sarge')
     self.assertEqual(dist.version, LATEST_SARGE_VERSION)
     path = '/sarge-%s.tar.gz' % LATEST_SARGE_VERSION
     for url in dist.download_urls:
         self.assertTrue(url.endswith(path))
     self.assertIn(dist.digests[url], LATEST_SARGE_HASHES)
     self.assertRaises(NotImplementedError, locator.get_distribution_names)
Example #7
0
lock_mgr = LockManager(lock_cfg)

if site.ENABLE_USER_SITE:
    user_distribution = UserDistributionPath()

# Setup distribution paths
local_distribution = LocalDistributionPath()
local_distribution.create_pypackages_pth()
# local_distribution.load_pypackages()

# TODO: is ephemeral pkgutil or site load with cleanup on exit
# atexit.register(local_distribution.remove_path)

# TODO setup proxy capability
# setup repository
locator = PyPIJSONLocator(urljoin(cfg.INDEX_URL, 'pypi'))

# Setup package manager
package_manager = PackageManager(
    source_tree=source_tree_mgr,
    lock=lock_mgr,
    distribution=local_distribution,
    locator=locator,
    force=False,
    update=False,
    options={}
)


def init(name: str) -> None:
    '''Initialize a new project.'''