Exemplo n.º 1
0
 def test_ensure_relative(self):
     if os.sep == '/':
         self.assertEqual(ensure_relative('/home/foo'), 'home/foo')
         self.assertEqual(ensure_relative('some/path'), 'some/path')
     else:  # \\
         self.assertEqual(ensure_relative('c:\\home\\foo'), 'c:home\\foo')
         self.assertEqual(ensure_relative('home\\foo'), 'home\\foo')
Exemplo n.º 2
0
 def test_ensure_relative(self):
     if os.sep == "/":
         self.assertEquals(ensure_relative("/home/foo"), "home/foo")
         self.assertEquals(ensure_relative("some/path"), "some/path")
     else:  # \\
         self.assertEquals(ensure_relative("c:\\home\\foo"), "c:home\\foo")
         self.assertEquals(ensure_relative("home\\foo"), "home\\foo")
Exemplo n.º 3
0
 def test_ensure_relative(self):
     if os.sep == '/':
         self.assertEqual(ensure_relative('/home/foo'), 'home/foo')
         self.assertEqual(ensure_relative('some/path'), 'some/path')
     else:
         self.assertEqual(ensure_relative('c:\\home\\foo'), 'c:home\\foo')
         self.assertEqual(ensure_relative('home\\foo'), 'home\\foo')
Exemplo n.º 4
0
 def run(self):
     if not self.skip_build:
         self.run_command('build')
     install = self.reinitialize_command('install', reinit_subcommands=1)
     install.root = self.bdist_dir
     install.skip_build = self.skip_build
     install.warn_dir = 0
     log.info('installing to %s' % self.bdist_dir)
     self.run_command('install')
     archive_basename = '%s.%s' % (self.distribution.get_fullname(), self.plat_name)
     if os.name == 'os2':
         archive_basename = archive_basename.replace(':', '-')
     pseudoinstall_root = os.path.join(self.dist_dir, archive_basename)
     if not self.relative:
         archive_root = self.bdist_dir
     elif self.distribution.has_ext_modules() and install.install_base != install.install_platbase:
         raise DistutilsPlatformError, "can't make a dumb built distribution where base and platbase are different (%s, %s)" % (repr(install.install_base), repr(install.install_platbase))
     else:
         archive_root = os.path.join(self.bdist_dir, ensure_relative(install.install_base))
     filename = self.make_archive(pseudoinstall_root, self.format, root_dir=archive_root, owner=self.owner, group=self.group)
     if self.distribution.has_ext_modules():
         pyversion = get_python_version()
     else:
         pyversion = 'any'
     self.distribution.dist_files.append(('bdist_dumb', pyversion, filename))
     if not self.keep_temp:
         remove_tree(self.bdist_dir, dry_run=self.dry_run)
Exemplo n.º 5
0
 def run(self):
     if not self.skip_build:
         self.run_command('build')
     install = self.reinitialize_command('install', reinit_subcommands=1)
     install.root = self.bdist_dir
     install.skip_build = self.skip_build
     install.warn_dir = 0
     log.info('installing to %s' % self.bdist_dir)
     self.run_command('install')
     archive_basename = '%s.%s' % (self.distribution.get_fullname(), self.plat_name)
     if os.name == 'os2':
         archive_basename = archive_basename.replace(':', '-')
     pseudoinstall_root = os.path.join(self.dist_dir, archive_basename)
     if not self.relative:
         archive_root = self.bdist_dir
     elif self.distribution.has_ext_modules() and install.install_base != install.install_platbase:
         raise DistutilsPlatformError, "can't make a dumb built distribution where base and platbase are different (%s, %s)" % (repr(install.install_base), repr(install.install_platbase))
     else:
         archive_root = os.path.join(self.bdist_dir, ensure_relative(install.install_base))
     filename = self.make_archive(pseudoinstall_root, self.format, root_dir=archive_root, owner=self.owner, group=self.group)
     if self.distribution.has_ext_modules():
         pyversion = get_python_version()
     else:
         pyversion = 'any'
     self.distribution.dist_files.append(('bdist_dumb', pyversion, filename))
     if not self.keep_temp:
         remove_tree(self.bdist_dir, dry_run=self.dry_run)
Exemplo n.º 6
0
	def _fix_paths(self):
		self.install_apps = self.install_base
		# manage --prefix option (i.e is set when in an environment created with *virtualenv*)
		if self.prefix_option is None and self.install_base == '/usr': # default prefix
			# TODO: specific install paths may not be changes if explicitly specified by user on command line (--install-scripts and --install-data options)
			(self.install_scripts, self.install_data, self.install_apps) = ('/usr/bin', '/', '/')

		# manage --root option (is set when doing "setup.py bdist")
		if self.root is not None:
			for p in ('scripts','data','apps'):
				setattr(self, 'install_'+p, os.path.join(self.root, ensure_relative(getattr(self, 'install_'+p))))
Exemplo n.º 7
0
    def run(self):
        if not self.skip_build:
            self.run_command('build')

        install = self.reinitialize_command('install', reinit_subcommands=1)
        install.root = self.bdist_dir
        install.skip_build = self.skip_build
        install.warn_dir = 0

        log.info("installing to %s" % self.bdist_dir)
        self.run_command('install')

        # And make an archive relative to the root of the
        # pseudo-installation tree.
        archive_basename = "%s.%s" % (self.distribution.get_fullname(),
                                      self.plat_name)

        # OS/2 objects to any ":" characters in a filename (such as when
        # a timestamp is used in a version) so change them to hyphens.
        if os.name == "os2":
            archive_basename = archive_basename.replace(":", "-")

        pseudoinstall_root = os.path.join(self.dist_dir, archive_basename)
        if not self.relative:
            archive_root = self.bdist_dir
        else:
            if (self.distribution.has_ext_modules()
                    and (install.install_base != install.install_platbase)):
                raise DistutilsPlatformError, \
                      ("can't make a dumb built distribution where "
                       "base and platbase are different (%s, %s)"
                       % (repr(install.install_base),
                          repr(install.install_platbase)))
            else:
                archive_root = os.path.join(
                    self.bdist_dir, ensure_relative(install.install_base))

        # Make the archive
        filename = self.make_archive(pseudoinstall_root,
                                     self.format,
                                     root_dir=archive_root,
                                     owner=self.owner,
                                     group=self.group)
        if self.distribution.has_ext_modules():
            pyversion = get_python_version()
        else:
            pyversion = 'any'
        self.distribution.dist_files.append(
            ('bdist_dumb', pyversion, filename))

        if not self.keep_temp:
            remove_tree(self.bdist_dir, dry_run=self.dry_run)
Exemplo n.º 8
0
    def run(self):
        if not self.skip_build:
            self.run_command('build')

        install = self.reinitialize_command('install', reinit_subcommands=1)
        install.root = self.bdist_dir
        install.skip_build = self.skip_build
        install.warn_dir = 0

        log.info("installing to %s", self.bdist_dir)
        self.run_command('install')

        # And make an archive relative to the root of the
        # pseudo-installation tree.
        archive_basename = "{}.{}".format(
            self.distribution.get_fullname(), self.plat_name
        )

        pseudoinstall_root = os.path.join(self.dist_dir, archive_basename)
        if not self.relative:
            archive_root = self.bdist_dir
        else:
            if self.distribution.has_ext_modules() and (
                install.install_base != install.install_platbase
            ):
                raise DistutilsPlatformError(
                    "can't make a dumb built distribution where "
                    "base and platbase are different (%s, %s)"
                    % (repr(install.install_base), repr(install.install_platbase))
                )
            else:
                archive_root = os.path.join(
                    self.bdist_dir, ensure_relative(install.install_base)
                )

        # Make the archive
        filename = self.make_archive(
            pseudoinstall_root,
            self.format,
            root_dir=archive_root,
            owner=self.owner,
            group=self.group,
        )
        if self.distribution.has_ext_modules():
            pyversion = get_python_version()
        else:
            pyversion = 'any'
        self.distribution.dist_files.append(('bdist_dumb', pyversion, filename))

        if not self.keep_temp:
            remove_tree(self.bdist_dir, dry_run=self.dry_run)
Exemplo n.º 9
0
    def run (self):

        if not self.skip_build:
            self.run_command('build')

        install = self.reinitialize_command('install', reinit_subcommands=1)
        install.root = self.bdist_dir
        install.skip_build = self.skip_build
        install.warn_dir = 0

        log.info("installing to %s" % self.bdist_dir)
        self.run_command('install')

        # And make an archive relative to the root of the
        # pseudo-installation tree.
        archive_basename = "%s.%s" % (self.distribution.get_fullname(),
                                      self.plat_name)

        # OS/2 objects to any ":" characters in a filename (such as when
        # a timestamp is used in a version) so change them to hyphens.
        if os.name == "os2":
            archive_basename = archive_basename.replace(":", "-")

        pseudoinstall_root = os.path.join(self.dist_dir, archive_basename)
        if not self.relative:
            archive_root = self.bdist_dir
        else:
            if (self.distribution.has_ext_modules() and
                (install.install_base != install.install_platbase)):
                raise DistutilsPlatformError, \
                      ("can't make a dumb built distribution where "
                       "base and platbase are different (%s, %s)"
                       % (repr(install.install_base),
                          repr(install.install_platbase)))
            else:
                archive_root = os.path.join(self.bdist_dir,
                                   ensure_relative(install.install_base))

        # Make the archive
        filename = self.make_archive(pseudoinstall_root,
                                     self.format, root_dir=archive_root)
        if self.distribution.has_ext_modules():
            pyversion = get_python_version()
        else:
            pyversion = 'any'
        self.distribution.dist_files.append(('bdist_dumb', pyversion,
                                             filename))

        if not self.keep_temp:
            remove_tree(self.bdist_dir, dry_run=self.dry_run)
Exemplo n.º 10
0
    def finalize_options(self):
        if self.bdist_dir is None:
            bdist_base = self.get_finalized_command('bdist').bdist_base
            self.bdist_dir = os.path.join(bdist_base, 'venv')

        if self.location_dir:
            self.location_dir = ensure_relative(self.location_dir)
            
        if self.extras:
            self.ensure_string_list('extras')

        self.set_undefined_options(
            'bdist',
            ('dist_dir', 'dist_dir'),
            ('plat_name', 'plat_name'),
        )
            
        if self.dist_name is None:
            self.dist_name = '%s.%s-py%s' % (
                self.distribution.get_fullname(),
                self.plat_name,
                get_python_version()
            )