Ejemplo n.º 1
0
    def test_no_optimize_flag(self):
        # let's create a package that breaks bdist_rpm
        tmp_dir = self.mkdtemp()
        os.environ['HOME'] = tmp_dir   # to confine dir '.rpmdb' creation
        pkg_dir = os.path.join(tmp_dir, 'foo')
        os.mkdir(pkg_dir)
        self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
        self.write_file((pkg_dir, 'foo.py'), '#')
        self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
        self.write_file((pkg_dir, 'README'), '')

        dist = Distribution({'name': 'foo', 'version': '0.1',
                             'py_modules': ['foo'],
                             'url': 'xxx', 'author': 'xxx',
                             'author_email': 'xxx'})
        dist.script_name = 'setup.py'
        os.chdir(pkg_dir)

        sys.argv = ['setup.py']
        cmd = bdist_rpm(dist)
        cmd.fix_python = True

        cmd.quiet = 1
        cmd.ensure_finalized()
        cmd.run()

        dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
        self.assertIn('foo-0.1-1.noarch.rpm', dist_created)

        # bug #2945: upload ignores bdist_rpm files
        self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'), dist.dist_files)
        self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'), dist.dist_files)

        os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm'))
Ejemplo n.º 2
0
 def test_quiet(self):
     tmp_dir = self.mkdtemp()
     pkg_dir = os.path.join(tmp_dir, 'foo')
     os.mkdir(pkg_dir)
     self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
     self.write_file((pkg_dir, 'foo.py'), '#')
     self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
     self.write_file((pkg_dir, 'README'), '')
     dist = Distribution({'name': 'foo',
      'version': '0.1',
      'py_modules': ['foo'],
      'url': 'xxx',
      'author': 'xxx',
      'author_email': 'xxx'})
     dist.script_name = 'setup.py'
     os.chdir(pkg_dir)
     sys.argv = ['setup.py']
     cmd = bdist_rpm(dist)
     cmd.fix_python = True
     cmd.quiet = 1
     cmd.ensure_finalized()
     cmd.run()
     dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
     self.assertIn('foo-0.1-1.noarch.rpm', dist_created)
     self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'), dist.dist_files)
     self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'), dist.dist_files)
Ejemplo n.º 3
0
 def test_quiet(self):
     tmp_dir = self.mkdtemp()
     os.environ['HOME'] = tmp_dir
     pkg_dir = os.path.join(tmp_dir, 'foo')
     os.mkdir(pkg_dir)
     self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
     self.write_file((pkg_dir, 'foo.py'), '#')
     self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
     self.write_file((pkg_dir, 'README'), '')
     dist = Distribution({
         'name': 'foo',
         'version': '0.1',
         'py_modules': ['foo'],
         'url': 'xxx',
         'author': 'xxx',
         'author_email': 'xxx'
     })
     dist.script_name = 'setup.py'
     os.chdir(pkg_dir)
     sys.argv = ['setup.py']
     cmd = bdist_rpm(dist)
     cmd.fix_python = True
     cmd.quiet = 1
     cmd.ensure_finalized()
     cmd.run()
     dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
     self.assertIn('foo-0.1-1.noarch.rpm', dist_created)
     self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'),
                   dist.dist_files)
     self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'),
                   dist.dist_files)
Ejemplo n.º 4
0
    def test_no_optimize_flag(self):
        # let's create a package that breaks bdist_rpm
        tmp_dir = self.mkdtemp()
        os.environ['HOME'] = tmp_dir   # to confine dir '.rpmdb' creation
        pkg_dir = os.path.join(tmp_dir, 'foo')
        os.mkdir(pkg_dir)
        self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
        self.write_file((pkg_dir, 'foo.py'), '#')
        self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
        self.write_file((pkg_dir, 'README'), '')

        dist = Distribution({'name': 'foo', 'version': '0.1',
                             'py_modules': ['foo'],
                             'url': 'xxx', 'author': 'xxx',
                             'author_email': 'xxx'})
        dist.script_name = 'setup.py'
        os.chdir(pkg_dir)

        sys.argv = ['setup.py']
        cmd = bdist_rpm(dist)
        cmd.fix_python = True

        cmd.quiet = 1
        cmd.ensure_finalized()
        cmd.run()

        dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
        self.assertIn('foo-0.1-1.noarch.rpm', dist_created)

        # bug #2945: upload ignores bdist_rpm files
        self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'), dist.dist_files)
        self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'), dist.dist_files)

        os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm'))
Ejemplo n.º 5
0
    def test_no_optimize_flag(self):

        # XXX I am unable yet to make this test work without
        # spurious sdtout/stderr output under Mac OS X
        if sys.platform != 'linux2':
            return

        # http://bugs.python.org/issue1533164
        # this test will run only if the rpm command is found
        if (find_executable('rpm') is None
                or find_executable('rpmbuild') is None):
            return

        # let's create a package that brakes bdist_rpm
        tmp_dir = self.mkdtemp()
        pkg_dir = os.path.join(tmp_dir, 'foo')
        os.mkdir(pkg_dir)
        self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
        self.write_file((pkg_dir, 'foo.py'), '#')
        self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
        self.write_file((pkg_dir, 'README'), '')

        dist = Distribution({
            'name': 'foo',
            'version': '0.1',
            'py_modules': ['foo'],
            'url': 'xxx',
            'author': 'xxx',
            'author_email': 'xxx'
        })
        dist.script_name = 'setup.py'
        os.chdir(pkg_dir)

        sys.argv = ['setup.py']
        cmd = bdist_rpm(dist)
        cmd.fix_python = True

        cmd.quiet = 1
        cmd.ensure_finalized()
        cmd.run()

        dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
        self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)

        # bug #2945: upload ignores bdist_rpm files
        self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'),
                      dist.dist_files)
        self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'),
                      dist.dist_files)

        os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm'))
Ejemplo n.º 6
0
    def test_no_optimize_flag(self):

        # XXX I am unable yet to make this test work without
        # spurious sdtout/stderr output under Mac OS X
        if sys.platform != "linux2":
            return

        # http://bugs.python.org/issue1533164
        # this test will run only if the rpm command is found
        if find_executable("rpm") is None or find_executable("rpmbuild") is None:
            return

        # let's create a package that brakes bdist_rpm
        tmp_dir = self.mkdtemp()
        pkg_dir = os.path.join(tmp_dir, "foo")
        os.mkdir(pkg_dir)
        self.write_file((pkg_dir, "setup.py"), SETUP_PY)
        self.write_file((pkg_dir, "foo.py"), "#")
        self.write_file((pkg_dir, "MANIFEST.in"), "include foo.py")
        self.write_file((pkg_dir, "README"), "")

        dist = Distribution(
            {
                "name": "foo",
                "version": "0.1",
                "py_modules": ["foo"],
                "url": "xxx",
                "author": "xxx",
                "author_email": "xxx",
            }
        )
        dist.script_name = "setup.py"
        os.chdir(pkg_dir)

        sys.argv = ["setup.py"]
        cmd = bdist_rpm(dist)
        cmd.fix_python = True

        cmd.quiet = 1
        cmd.ensure_finalized()
        cmd.run()

        dist_created = os.listdir(os.path.join(pkg_dir, "dist"))
        self.assertTrue("foo-0.1-1.noarch.rpm" in dist_created)

        # bug #2945: upload ignores bdist_rpm files
        self.assertIn(("bdist_rpm", "any", "dist/foo-0.1-1.src.rpm"), dist.dist_files)
        self.assertIn(("bdist_rpm", "any", "dist/foo-0.1-1.noarch.rpm"), dist.dist_files)

        os.remove(os.path.join(pkg_dir, "dist", "foo-0.1-1.noarch.rpm"))
Ejemplo n.º 7
0
    def test_no_optimize_flag(self):

        # XXX I am unable yet to make this test work without
        # spurious sdtout/stderr output under Mac OS X
        if not sys.platform.startswith('linux'):
            return

        # http://bugs.python.org/issue1533164
        # this test will run only if the rpm command is found
        if (find_executable('rpm') is None or
            find_executable('rpmbuild') is None):
            return

        # let's create a package that brakes bdist_rpm
        tmp_dir = self.mkdtemp()
        pkg_dir = os.path.join(tmp_dir, 'foo')
        os.mkdir(pkg_dir)
        self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
        self.write_file((pkg_dir, 'foo.py'), '#')
        self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
        self.write_file((pkg_dir, 'README'), '')

        dist = Distribution({'name': 'foo', 'version': '0.1',
                             'py_modules': ['foo'],
                             'url': 'xxx', 'author': 'xxx',
                             'author_email': 'xxx'})
        dist.script_name = 'setup.py'
        os.chdir(pkg_dir)

        sys.argv = ['setup.py']
        cmd = bdist_rpm(dist)
        cmd.fix_python = True

        cmd.quiet = 1
        cmd.ensure_finalized()
        cmd.run()

        dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
        self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)

        # bug #2945: upload ignores bdist_rpm files
        self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm'), dist.dist_files)
        self.assertIn(('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm'), dist.dist_files)

        os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm'))
Ejemplo n.º 8
0
    def test_quiet(self):

        # XXX I am unable yet to make this test work without
        # spurious sdtout/stderr output under Mac OS X
        if sys.platform != 'linux2':
            return

        # this test will run only if the rpm commands are found
        if (find_executable('rpm') is None
                or find_executable('rpmbuild') is None):
            return

        # let's create a package
        tmp_dir = self.mkdtemp()
        pkg_dir = os.path.join(tmp_dir, 'foo')
        os.mkdir(pkg_dir)
        self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
        self.write_file((pkg_dir, 'foo.py'), '#')
        self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
        self.write_file((pkg_dir, 'README'), '')

        dist = Distribution({
            'name': 'foo',
            'version': '0.1',
            'py_modules': ['foo'],
            'url': 'xxx',
            'author': 'xxx',
            'author_email': 'xxx'
        })
        dist.script_name = 'setup.py'
        os.chdir(pkg_dir)

        sys.argv = ['setup.py']
        cmd = bdist_rpm(dist)
        cmd.fix_python = True

        # running in quiet mode
        cmd.quiet = 1
        cmd.ensure_finalized()
        cmd.run()

        dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
        self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)
Ejemplo n.º 9
0
    def test_quiet(self):

        # XXX I am unable yet to make this test work without
        # spurious sdtout/stderr output under Mac OS X
        if sys.platform != 'linux2':
            return

        # this test will run only if the rpm commands are found
        if (find_executable('rpm') is None or
            find_executable('rpmbuild') is None):
            return

        # let's create a package
        tmp_dir = self.mkdtemp()
        pkg_dir = os.path.join(tmp_dir, 'foo')
        os.mkdir(pkg_dir)
        self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
        self.write_file((pkg_dir, 'foo.py'), '#')
        self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
        self.write_file((pkg_dir, 'README'), '')

        dist = Distribution({'name': 'foo', 'version': '0.1',
                             'py_modules': ['foo'],
                             'url': 'xxx', 'author': 'xxx',
                             'author_email': 'xxx'})
        dist.script_name = 'setup.py'
        os.chdir(pkg_dir)

        sys.argv = ['setup.py']
        cmd = bdist_rpm(dist)
        cmd.fix_python = True

        # running in quiet mode
        cmd.quiet = 1
        cmd.ensure_finalized()
        cmd.run()

        dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
        self.assertTrue('foo-0.1-1.noarch.rpm' in dist_created)
Ejemplo n.º 10
0
    def test_no_optimize_flag(self):
        # let's create a package that brakes bdist_rpm
        tmp_dir = self.mkdtemp()
        pkg_dir = os.path.join(tmp_dir, "foo")
        os.mkdir(pkg_dir)
        self.write_file((pkg_dir, "setup.py"), SETUP_PY)
        self.write_file((pkg_dir, "foo.py"), "#")
        self.write_file((pkg_dir, "MANIFEST.in"), "include foo.py")
        self.write_file((pkg_dir, "README"), "")

        dist = Distribution(
            {
                "name": "foo",
                "version": "0.1",
                "py_modules": ["foo"],
                "url": "xxx",
                "author": "xxx",
                "author_email": "xxx",
            }
        )
        dist.script_name = "setup.py"
        os.chdir(pkg_dir)

        sys.argv = ["setup.py"]
        cmd = bdist_rpm(dist)
        cmd.fix_python = True

        cmd.quiet = 1
        cmd.ensure_finalized()
        cmd.run()

        dist_created = os.listdir(os.path.join(pkg_dir, "dist"))
        self.assertIn("foo-0.1-1.noarch.rpm", dist_created)

        # bug #2945: upload ignores bdist_rpm files
        self.assertIn(("bdist_rpm", "any", "dist/foo-0.1-1.src.rpm"), dist.dist_files)
        self.assertIn(("bdist_rpm", "any", "dist/foo-0.1-1.noarch.rpm"), dist.dist_files)

        os.remove(os.path.join(pkg_dir, "dist", "foo-0.1-1.noarch.rpm"))