Пример #1
0
    def test_egginfo_to_distinfo_setuptools(self):
        distinfo = 'hello-0.1.1-py3.3.dist-info'
        egginfo = 'hello-0.1.1-py3.3.egg-info'
        dirs = [egginfo]
        files = ['hello.py', 'hello.pyc']
        extra_metadata = ['dependency_links.txt', 'entry_points.txt',
                          'not-zip-safe', ('PKG-INFO', PKG_INFO),
                          'top_level.txt', 'SOURCES.txt']
        for f in extra_metadata:
            if isinstance(f, tuple):
                f, content = f
            else:
                content = 'XXX'
            files.append((os.path.join(egginfo, f), content))

        tempdir, record_file = self.build_dist_tree(files, dirs)
        distinfo_path = os.path.join(tempdir, distinfo)
        egginfo_path = os.path.join(tempdir, egginfo)
        metadata_file_paths = self.get_metadata_file_paths(distinfo_path)

        egginfo_to_distinfo(record_file)
        # test that directories and files get created
        self.assertTrue(os.path.isdir(distinfo_path))
        self.assertTrue(os.path.isdir(egginfo_path))

        for mfile in metadata_file_paths:
            self.assertTrue(os.path.isfile(mfile))
Пример #2
0
def _run_setuptools_install(path, dest):
    cmd = '%s setup.py install --record=%s --single-version-externally-managed'
    record_file = os.path.join(path, 'RECORD')

    os.system(cmd % (sys.executable, record_file))
    if not os.path.exists(record_file):
        raise ValueError('failed to install')
    else:
        egginfo_to_distinfo(record_file, remove_egginfo=True)
Пример #3
0
def _run_setuptools_install(path, dest):
    cmd = '%s setup.py install --record=%s --single-version-externally-managed'
    record_file = os.path.join(path, 'RECORD')

    os.system(cmd % (sys.executable, record_file))
    if not os.path.exists(record_file):
        raise ValueError('failed to install')
    else:
        egginfo_to_distinfo(record_file, remove_egginfo=True)
Пример #4
0
def _run_distutils_install(path, dest):
    # backward compat: using setuptools or plain-distutils
    # FIXME pass dest argument to the command
    cmd = '%s setup.py install --record=%s'
    record_file = os.path.join(path, 'RECORD')
    # FIXME use subprocess
    os.system(cmd % (sys.executable, record_file))
    if not os.path.exists(record_file):
        raise ValueError('failed to install')
    else:
        egginfo_to_distinfo(record_file, remove_egginfo=True)
Пример #5
0
def _run_distutils_install(path, dest):
    # backward compat: using setuptools or plain-distutils
    # FIXME pass dest argument to the command
    cmd = '%s setup.py install --record=%s'
    record_file = os.path.join(path, 'RECORD')
    # FIXME use subprocess
    os.system(cmd % (sys.executable, record_file))
    if not os.path.exists(record_file):
        raise ValueError('failed to install')
    else:
        egginfo_to_distinfo(record_file, remove_egginfo=True)
Пример #6
0
    def test_egginfo_to_distinfo_distutils(self):
        distinfo = 'hello-0.1.1-py3.3.dist-info'
        egginfo = 'hello-0.1.1-py3.3.egg-info'
        # egginfo is a file in distutils which contains the metadata
        files = ['hello.py', 'hello.pyc', (egginfo, PKG_INFO)]

        tempdir, record_file = self.build_dist_tree(files, dirs=[])
        distinfo_path = os.path.join(tempdir, distinfo)
        egginfo_path = os.path.join(tempdir, egginfo)
        metadata_file_paths = self.get_metadata_file_paths(distinfo_path)
        egginfo_to_distinfo(record_file)
        # test that directories and files get created
        self.assertTrue(os.path.isdir(distinfo_path))
        self.assertTrue(os.path.isfile(egginfo_path))

        for mfile in metadata_file_paths:
            self.assertTrue(os.path.isfile(mfile))