示例#1
0
 def test_simple_built(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_dumb(dist)
     cmd.format = 'zip'
     cmd.ensure_finalized()
     cmd.run()
     dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
     base = '%s.%s.zip' % (dist.get_fullname(), cmd.plat_name)
     self.assertEqual(dist_created, [base])
     fp = zipfile.ZipFile(os.path.join('dist', base))
     try:
         contents = fp.namelist()
     finally:
         fp.close()
     contents = sorted(os.path.basename(fn) for fn in contents)
     wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2], 'foo.py']
     if not sys.dont_write_bytecode:
         wanted.append('foo.%s.pyc' % sys.implementation.cache_tag)
     self.assertEqual(contents, sorted(wanted))
示例#2
0
 def test_finalize_options(self):
     pkg_dir, dist = self.create_dist()
     os.chdir(pkg_dir)
     cmd = bdist_dumb(dist)
     self.assertEqual(cmd.bdist_dir, None)
     cmd.finalize_options()
     base = cmd.get_finalized_command('bdist').bdist_base
     self.assertEqual(cmd.bdist_dir, os.path.join(base, 'dumb'))
     default = cmd.default_format[os.name]
     self.assertEqual(cmd.format, default)
     return
示例#3
0
 def test_finalize_options(self):
     pkg_dir, dist = self.create_dist()
     os.chdir(pkg_dir)
     cmd = bdist_dumb(dist)
     self.assertEqual(cmd.bdist_dir, None)
     cmd.finalize_options()
     base = cmd.get_finalized_command('bdist').bdist_base
     self.assertEqual(cmd.bdist_dir, os.path.join(base, 'dumb'))
     default = cmd.default_format[os.name]
     self.assertEqual(cmd.format, default)
     return
示例#4
0
    def test_simple_built(self):

        # let's create a simple 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_dumb(dist)

        # so the output is the same no matter
        # what is the platform
        cmd.format = 'zip'

        cmd.ensure_finalized()
        cmd.run()

        # see what we have
        dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
        base = "%s.%s.zip" % (dist.get_fullname(), cmd.plat_name)
        if os.name == 'os2':
            base = base.replace(':', '-')

        self.assertEqual(dist_created, [base])

        # now let's check what we have in the zip file
        fp = zipfile.ZipFile(os.path.join('dist', base))
        try:
            contents = fp.namelist()
        finally:
            fp.close()

        contents = sorted(os.path.basename(fn) for fn in contents)
        wanted = [
            'foo-0.1-py%s.%s.egg-info' % sys.version_info[:2], 'foo.py',
            'foo.pyc'
        ]
        self.assertEqual(contents, sorted(wanted))
示例#5
0
    def test_simple_built(self):

        # let's create a simple 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_dumb(dist)

        # so the output is the same no matter
        # what is the platform
        cmd.format = "zip"

        cmd.ensure_finalized()
        cmd.run()

        # see what we have
        dist_created = os.listdir(os.path.join(pkg_dir, "dist"))
        base = "%s.%s.zip" % (dist.get_fullname(), cmd.plat_name)
        if os.name == "os2":
            base = base.replace(":", "-")

        self.assertEqual(dist_created, [base])

        # now let's check what we have in the zip file
        fp = zipfile.ZipFile(os.path.join("dist", base))
        try:
            contents = fp.namelist()
        finally:
            fp.close()

        contents = sorted(os.path.basename(fn) for fn in contents)
        wanted = ["foo-0.1-py%s.%s.egg-info" % sys.version_info[:2], "foo.%s.pyc" % imp.get_tag(), "foo.py"]
        self.assertEqual(contents, sorted(wanted))
    def test_finalize_options(self):
        pkg_dir, dist = self.create_dist()
        os.chdir(pkg_dir)
        cmd = bdist_dumb(dist)
        self.assertEqual(cmd.bdist_dir, None)
        cmd.finalize_options()

        # bdist_dir is initialized to bdist_base/dumb if not set
        base = cmd.get_finalized_command('bdist').bdist_base
        self.assertEqual(cmd.bdist_dir, os.path.join(base, 'dumb'))

        # the format is set to a default value depending on the os.name
        default = cmd.default_format[os.name]
        self.assertEqual(cmd.format, default)
示例#7
0
    def test_finalize_options(self):
        pkg_dir, dist = self.create_dist()
        os.chdir(pkg_dir)
        cmd = bdist_dumb(dist)
        self.assertEqual(cmd.bdist_dir, None)
        cmd.finalize_options()

        # bdist_dir is initialized to bdist_base/dumb if not set
        base = cmd.get_finalized_command('bdist').bdist_base
        self.assertEqual(cmd.bdist_dir, os.path.join(base, 'dumb'))

        # the format is set to a default value depending on the os.name
        default = cmd.default_format[os.name]
        self.assertEqual(cmd.format, default)
示例#8
0
    def test_simple_built(self):

        # let's create a simple 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_dumb(dist)

        # so the output is the same no matter
        # what is the platform
        cmd.format = 'zip'

        cmd.ensure_finalized()
        cmd.run()

        # see what we have
        dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
        base = "%s.%s.zip" % (dist.get_fullname(), cmd.plat_name)
        if os.name == 'os2':
            base = base.replace(':', '-')

        self.assertEqual(dist_created, [base])

        # now let's check what we have in the zip file
        fp = zipfile.ZipFile(os.path.join('dist', base))
        try:
            contents = fp.namelist()
        finally:
            fp.close()

        contents = sorted(os.path.basename(fn) for fn in contents)
        wanted = ['foo-0.1-py%s.%s.egg-info' % sys.version_info[:2], 'foo.py']
        if not sys.dont_write_bytecode:
            wanted.append('foo.pyc')
        self.assertEqual(contents, sorted(wanted))
示例#9
0
    def test_simple_built(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_dumb(dist)
        cmd.format = "zip"
        cmd.ensure_finalized()
        cmd.run()
        dist_created = os.listdir(os.path.join(pkg_dir, "dist"))
        base = "%s.%s.zip" % (dist.get_fullname(), cmd.plat_name)
        if os.name == "os2":
            base = base.replace(":", "-")
        self.assertEqual(dist_created, [base])
        fp = zipfile.ZipFile(os.path.join("dist", base))
        try:
            contents = fp.namelist()
        finally:
            fp.close()

        contents = sorted((os.path.basename(fn) for fn in contents))
        wanted = ["foo-0.1-py%s.%s.egg-info" % sys.version_info[:2], "foo.py"]
        if not sys.dont_write_bytecode:
            wanted.append("foo.pyc")
        self.assertEqual(contents, sorted(wanted))
示例#10
0
    def test_simple_built(self):

        # let's create a simple 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_dumb(dist)

        # so the output is the same no matter
        # what is the platform
        cmd.format = 'zip'

        cmd.ensure_finalized()
        cmd.run()

        # see what we have
        dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
        base = "%s.%s" % (dist.get_fullname(), cmd.plat_name)
        if os.name == 'os2':
            base = base.replace(':', '-')

        wanted = ['%s.zip' % base]
        self.assertEqual(dist_created, wanted)
示例#11
0
    def test_simple_built(self):

        # let's create a simple 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_dumb(dist)

        # so the output is the same no matter
        # what is the platform
        cmd.format = 'zip'

        cmd.ensure_finalized()
        cmd.run()

        # see what we have
        dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
        base = "%s.%s" % (dist.get_fullname(), cmd.plat_name)
        if os.name == 'os2':
            base = base.replace(':', '-')

        wanted = ['%s.zip' % base]
        self.assertEquals(dist_created, wanted)