Example #1
0
def get_packing_list(source_dirs):
  """Consolidate the list of things to pack.

  Args:
    source_dirs (list of str): local source packages locations.
  """
  packing_list = []
  for source_dir in source_dirs:
    location = util.path2fileurl(os.path.abspath(source_dir))
    if os.path.isfile(os.path.join(source_dir, 'setup.py')):
      package_type = 'standard'
    elif (os.path.isfile(os.path.join(source_dir, 'setup.cfg')) and
          os.path.isfile(os.path.join(source_dir, '__init__.py'))):
      package_type = 'bare'
    else:
      package_type = 'unhandled'
      if not os.path.exists(source_dir):
        package_type = 'missing'
    packing_list.append({'location': location, 'package_type': package_type})
  return packing_list
Example #2
0
def get_packing_list(source_dirs):
    """Consolidate the list of things to pack.

  Args:
    source_dirs (list of str): local source packages locations.
  """
    packing_list = []
    for source_dir in source_dirs:
        location = util.path2fileurl(os.path.abspath(source_dir))
        if os.path.isfile(os.path.join(source_dir, 'setup.py')):
            package_type = 'standard'
        elif (os.path.isfile(os.path.join(source_dir, 'setup.cfg'))
              and os.path.isfile(os.path.join(source_dir, '__init__.py'))):
            package_type = 'bare'
        else:
            package_type = 'unhandled'
            if not os.path.exists(source_dir):
                package_type = 'missing'
        packing_list.append({
            'location': location,
            'package_type': package_type
        })
    return packing_list
Example #3
0
 def test_errors_out_with_relative_path(self):
   path = os.path.join('part', 'of', 'path')
   with self.assertRaises(ValueError):
     util.path2fileurl(path)
Example #4
0
 def test_url_to_path_to_url_absolute_path(self):
   url1 = 'file:///absolutely/normal/path/'
   url2 = util.path2fileurl(util.fileurl2path(url1))
   self.assertEqual(url1, url2)
Example #5
0
 def test_url_to_path_to_url_with_spaces(self):
   url1 = 'file:///absolute/path/with%20spaces'
   url2 = util.path2fileurl(util.fileurl2path(url1))
   self.assertEqual(url1, url2)
Example #6
0
 def test_url_to_path_to_url(self):
   url1 = 'file:///this/is/a/path'
   url2 = util.path2fileurl(util.fileurl2path(url1))
   self.assertEqual(url1, url2)
Example #7
0
 def test_path_to_url_to_path(self):
   # Use an existing file as a way to get an OS-specific absolute path.
   path = util.fileurl2path(util.path2fileurl(ROOT_DIR))
   self.assertEqual(path, ROOT_DIR)
Example #8
0
 def test_errors_out_with_relative_path(self):
     path = os.path.join('part', 'of', 'path')
     with self.assertRaises(ValueError):
         util.path2fileurl(path)
Example #9
0
 def test_url_to_path_to_url_absolute_path(self):
     url1 = 'file:///absolutely/normal/path/'
     url2 = util.path2fileurl(util.fileurl2path(url1))
     self.assertEqual(url1, url2)
Example #10
0
 def test_url_to_path_to_url_with_spaces(self):
     url1 = 'file:///absolute/path/with%20spaces'
     url2 = util.path2fileurl(util.fileurl2path(url1))
     self.assertEqual(url1, url2)
Example #11
0
 def test_url_to_path_to_url(self):
     url1 = 'file:///this/is/a/path'
     url2 = util.path2fileurl(util.fileurl2path(url1))
     self.assertEqual(url1, url2)
Example #12
0
 def test_path_to_url_to_path(self):
     # Use an existing file as a way to get an OS-specific absolute path.
     path = util.fileurl2path(util.path2fileurl(ROOT_DIR))
     self.assertEqual(path, ROOT_DIR)