]>
git.proxmox.com Git - mirror_edk2.git/blob - AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/command/bdist_dumb.py
1 """distutils.command.bdist_dumb
3 Implements the Distutils 'bdist_dumb' command (create a "dumb" built
4 distribution -- i.e., just an archive to be unpacked under $prefix or
11 from sysconfig
import get_python_version
13 from distutils
.util
import get_platform
14 from distutils
.core
import Command
15 from distutils
.dir_util
import remove_tree
, ensure_relative
16 from distutils
.errors
import DistutilsPlatformError
17 from distutils
import log
19 class bdist_dumb (Command
):
21 description
= 'create a "dumb" built distribution'
23 user_options
= [('bdist-dir=', 'd',
24 "temporary directory for creating the distribution"),
26 "platform name to embed in generated filenames "
27 "(default: %s)" % get_platform()),
29 "archive format to create (tar, ztar, gztar, zip)"),
31 "keep the pseudo-installation tree around after " +
32 "creating the distribution archive"),
34 "directory to put final built distributions in"),
36 "skip rebuilding everything (for testing/debugging)"),
38 "build the archive using relative paths"
41 "Owner name used when creating a tar file"
42 " [default: current user]"),
44 "Group name used when creating a tar file"
45 " [default: current group]"),
48 boolean_options
= ['keep-temp', 'skip-build', 'relative']
50 default_format
= { 'posix': 'gztar',
55 def initialize_options (self
):
66 def finalize_options(self
):
67 if self
.bdist_dir
is None:
68 bdist_base
= self
.get_finalized_command('bdist').bdist_base
69 self
.bdist_dir
= os
.path
.join(bdist_base
, 'dumb')
71 if self
.format
is None:
73 self
.format
= self
.default_format
[os
.name
]
75 raise DistutilsPlatformError
, \
76 ("don't know how to create dumb built distributions " +
77 "on platform %s") % os
.name
79 self
.set_undefined_options('bdist',
80 ('dist_dir', 'dist_dir'),
81 ('plat_name', 'plat_name'))
84 if not self
.skip_build
:
85 self
.run_command('build')
87 install
= self
.reinitialize_command('install', reinit_subcommands
=1)
88 install
.root
= self
.bdist_dir
89 install
.skip_build
= self
.skip_build
92 log
.info("installing to %s" % self
.bdist_dir
)
93 self
.run_command('install')
95 # And make an archive relative to the root of the
96 # pseudo-installation tree.
97 archive_basename
= "%s.%s" % (self
.distribution
.get_fullname(),
100 # OS/2 objects to any ":" characters in a filename (such as when
101 # a timestamp is used in a version) so change them to hyphens.
103 archive_basename
= archive_basename
.replace(":", "-")
105 pseudoinstall_root
= os
.path
.join(self
.dist_dir
, archive_basename
)
106 if not self
.relative
:
107 archive_root
= self
.bdist_dir
109 if (self
.distribution
.has_ext_modules() and
110 (install
.install_base
!= install
.install_platbase
)):
111 raise DistutilsPlatformError
, \
112 ("can't make a dumb built distribution where "
113 "base and platbase are different (%s, %s)"
114 % (repr(install
.install_base
),
115 repr(install
.install_platbase
)))
117 archive_root
= os
.path
.join(self
.bdist_dir
,
118 ensure_relative(install
.install_base
))
121 filename
= self
.make_archive(pseudoinstall_root
,
122 self
.format
, root_dir
=archive_root
,
123 owner
=self
.owner
, group
=self
.group
)
124 if self
.distribution
.has_ext_modules():
125 pyversion
= get_python_version()
128 self
.distribution
.dist_files
.append(('bdist_dumb', pyversion
,
131 if not self
.keep_temp
:
132 remove_tree(self
.bdist_dir
, dry_run
=self
.dry_run
)