예제 #1
0
파일: pack.py 프로젝트: eunchong/infra
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
예제 #2
0
파일: pack.py 프로젝트: xinghun61/infra
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
예제 #3
0
파일: util_test.py 프로젝트: eunchong/infra
 def test_errors_out_with_relative_path(self):
   path = os.path.join('part', 'of', 'path')
   with self.assertRaises(ValueError):
     util.path2fileurl(path)
예제 #4
0
파일: util_test.py 프로젝트: eunchong/infra
 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)
예제 #5
0
파일: util_test.py 프로젝트: eunchong/infra
 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)
예제 #6
0
파일: util_test.py 프로젝트: eunchong/infra
 def test_url_to_path_to_url(self):
   url1 = 'file:///this/is/a/path'
   url2 = util.path2fileurl(util.fileurl2path(url1))
   self.assertEqual(url1, url2)
예제 #7
0
파일: util_test.py 프로젝트: eunchong/infra
 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)
예제 #8
0
 def test_errors_out_with_relative_path(self):
     path = os.path.join('part', 'of', 'path')
     with self.assertRaises(ValueError):
         util.path2fileurl(path)
예제 #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)
예제 #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)
예제 #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)
예제 #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)