コード例 #1
0
    def test_metadata_requires_description_files(self):
        # Create the following file structure:
        #   README
        #   README2
        #   script1.py
        #   scripts/
        #       find-coconuts
        #   bin/
        #       taunt
        #   src/
        #       haven.py
        #       one/__init__.py
        #       two/__init__.py
        #       three/__init__.py

        self.write_setup({
            'description-file': 'README\n  README2',
            'extra-files': '\n  README3'
        })
        self.write_file('README', 'yeah 1')
        self.write_file('README2', 'yeah 2')
        self.write_file('README3', 'yeah 3')
        os.mkdir('src')
        self.write_file(('src', 'haven.py'), '#')
        self.write_file('script1.py', '#')
        os.mkdir('scripts')
        self.write_file(('scripts', 'find-coconuts'), '#')
        os.mkdir('bin')
        self.write_file(('bin', 'taunt'), '#')

        for pkg in ('one', 'two', 'three'):
            pkg = os.path.join('src', pkg)
            os.mkdir(pkg)
            self.write_file((pkg, '__init__.py'), '#')

        dist = self.get_dist()
        self.assertIn('yeah 1\nyeah 2', dist.metadata['description'])

        cmd = sdist(dist)
        cmd.finalize_options()
        cmd.get_file_list()
        self.assertRaises(PackagingFileError, cmd.make_distribution)

        self.write_setup({
            'description-file': 'README\n  README2',
            'extra-files': '\n  README2\n    README'
        })
        dist = self.get_dist()
        cmd = sdist(dist)
        cmd.finalize_options()
        cmd.get_file_list()
        cmd.make_distribution()
        with open('MANIFEST') as fp:
            self.assertIn('README\nREADME2\n', fp.read())
コード例 #2
0
ファイル: test_config.py プロジェクト: dstufft/distutils2
    def test_metadata_requires_description_files(self):
        # Create the following file structure:
        #   README
        #   README2
        #   script1.py
        #   scripts/
        #       find-coconuts
        #   bin/
        #       taunt
        #   src/
        #       haven.py
        #       one/__init__.py
        #       two/__init__.py
        #       three/__init__.py

        self.write_setup({'description-file': 'README\n  README2',
                          'extra-files': '\n  README3'})
        self.write_file('README', 'yeah 1')
        self.write_file('README2', 'yeah 2')
        self.write_file('README3', 'yeah 3')
        os.mkdir('src')
        self.write_file(('src', 'haven.py'), '#')
        self.write_file('script1.py', '#')
        os.mkdir('scripts')
        self.write_file(('scripts', 'find-coconuts'), '#')
        os.mkdir('bin')
        self.write_file(('bin', 'taunt'), '#')

        for pkg in ('one', 'two', 'three'):
            pkg = os.path.join('src', pkg)
            os.mkdir(pkg)
            self.write_file((pkg, '__init__.py'), '#')

        dist = self.get_dist()
        self.assertIn('yeah 1\nyeah 2', dist.metadata['description'])

        cmd = sdist(dist)
        cmd.finalize_options()
        cmd.get_file_list()
        self.assertRaises(PackagingFileError, cmd.make_distribution)

        self.write_setup({'description-file': 'README\n  README2',
                          'extra-files': '\n  README2\n    README'})
        dist = self.get_dist()
        cmd = sdist(dist)
        cmd.finalize_options()
        cmd.get_file_list()
        cmd.make_distribution()
        fp = open('MANIFEST')
        try:
            self.assertIn('README\nREADME2\n', fp.read())
        finally:
            fp.close()
コード例 #3
0
 def get_cmd(self, metadata=None):
     """Returns a cmd"""
     if metadata is None:
         metadata = {'name': 'fake', 'version': '1.0',
                     'home_page': 'xxx', 'author': 'xxx',
                     'author_email': 'xxx'}
     dist = Distribution(metadata)
     dist.packages = ['somecode']
     cmd = sdist(dist)
     cmd.dist_dir = 'dist'
     return dist, cmd
コード例 #4
0
 def get_cmd(self, metadata=None):
     """Returns a cmd"""
     if metadata is None:
         metadata = {'name': 'fake', 'version': '1.0',
                     'home_page': 'xxx', 'author': 'xxx',
                     'author_email': 'xxx'}
     dist = Distribution(metadata)
     dist.packages = ['somecode']
     cmd = sdist(dist)
     cmd.dist_dir = 'dist'
     return dist, cmd
コード例 #5
0
 def get_cmd(self, metadata=None):
     """Returns a cmd"""
     if metadata is None:
         metadata = {'name': 'fake', 'version': '1.0',
                     'url': 'xxx', 'author': 'xxx',
                     'author_email': 'xxx'}
     dist = Distribution(metadata)
     dist.script_name = 'setup.py'
     dist.packages = ['somecode']
     dist.include_package_data = True
     cmd = sdist(dist)
     cmd.dist_dir = 'dist'
     def _warn(*args):
         pass
     cmd.warn = _warn
     return dist, cmd
コード例 #6
0
ファイル: test_sdist.py プロジェクト: francescog/distutils2
    def get_cmd(self, metadata=None):
        """Returns a cmd"""
        if metadata is None:
            metadata = {"name": "fake", "version": "1.0", "url": "xxx", "author": "xxx", "author_email": "xxx"}
        dist = Distribution(metadata)
        dist.script_name = "setup.py"
        dist.packages = ["somecode"]
        dist.include_package_data = True
        cmd = sdist(dist)
        cmd.dist_dir = "dist"

        def _warn(*args):
            pass

        cmd.warn = _warn
        return dist, cmd
コード例 #7
0
    def test_metadata_requires_description_files_missing(self):
        self.write_setup({'description-file': 'README README2'})
        self.write_file('README', 'yeah')
        self.write_file('README2', 'yeah')
        os.mkdir('src')
        self.write_file(('src', 'haven.py'), '#')
        self.write_file('script1.py', '#')
        os.mkdir('scripts')
        self.write_file(('scripts', 'find-coconuts'), '#')
        os.mkdir('bin')
        self.write_file(('bin', 'taunt'), '#')

        for pkg in ('one', 'two', 'three'):
            pkg = os.path.join('src', pkg)
            os.mkdir(pkg)
            self.write_file((pkg, '__init__.py'), '#')

        dist = self.get_dist()
        cmd = sdist(dist)
        cmd.finalize_options()
        cmd.get_file_list()
        self.assertRaises(PackagingFileError, cmd.make_distribution)
コード例 #8
0
ファイル: test_config.py プロジェクト: dstufft/distutils2
    def test_metadata_requires_description_files_missing(self):
        self.write_setup({'description-file': 'README README2'})
        self.write_file('README', 'yeah')
        self.write_file('README2', 'yeah')
        os.mkdir('src')
        self.write_file(('src', 'haven.py'), '#')
        self.write_file('script1.py', '#')
        os.mkdir('scripts')
        self.write_file(('scripts', 'find-coconuts'), '#')
        os.mkdir('bin')
        self.write_file(('bin', 'taunt'), '#')

        for pkg in ('one', 'two', 'three'):
            pkg = os.path.join('src', pkg)
            os.mkdir(pkg)
            self.write_file((pkg, '__init__.py'), '#')

        dist = self.get_dist()
        cmd = sdist(dist)
        cmd.finalize_options()
        cmd.get_file_list()
        self.assertRaises(PackagingFileError, cmd.make_distribution)