]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/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
7 # This module should be kept compatible with Python 1.5.2.
12 from distutils
.core
import Command
13 from distutils
.util
import get_platform
14 from distutils
.dir_util
import create_tree
, remove_tree
, ensure_relative
15 from distutils
.errors
import *
16 from distutils
import log
18 class bdist_dumb (Command
):
20 description
= "create a \"dumb\" built distribution"
22 user_options
= [('bdist-dir=', 'd',
23 "temporary directory for creating the distribution"),
25 "platform name to embed in generated filenames "
26 "(default: %s)" % get_platform()),
28 "archive format to create (tar, ztar, gztar, zip)"),
30 "keep the pseudo-installation tree around after " +
31 "creating the distribution archive"),
33 "directory to put final built distributions in"),
35 "skip rebuilding everything (for testing/debugging)"),
37 "build the archive using relative paths"
41 boolean_options
= ['keep-temp', 'skip-build', 'relative']
43 default_format
= { 'posix': 'gztar',
48 def initialize_options (self
):
57 # initialize_options()
60 def finalize_options (self
):
62 if self
.bdist_dir
is None:
63 bdist_base
= self
.get_finalized_command('bdist').bdist_base
64 self
.bdist_dir
= os
.path
.join(bdist_base
, 'dumb')
66 if self
.format
is None:
68 self
.format
= self
.default_format
[os
.name
]
70 raise DistutilsPlatformError
, \
71 ("don't know how to create dumb built distributions " +
72 "on platform %s") % os
.name
74 self
.set_undefined_options('bdist',
75 ('dist_dir', 'dist_dir'),
76 ('plat_name', 'plat_name'))
83 if not self
.skip_build
:
84 self
.run_command('build')
86 install
= self
.reinitialize_command('install', reinit_subcommands
=1)
87 install
.root
= self
.bdist_dir
88 install
.skip_build
= self
.skip_build
91 log
.info("installing to %s" % self
.bdist_dir
)
92 self
.run_command('install')
94 # And make an archive relative to the root of the
95 # pseudo-installation tree.
96 archive_basename
= "%s.%s" % (self
.distribution
.get_fullname(),
99 # OS/2 objects to any ":" characters in a filename (such as when
100 # a timestamp is used in a version) so change them to hyphens.
102 archive_basename
= archive_basename
.replace(":", "-")
104 pseudoinstall_root
= os
.path
.join(self
.dist_dir
, archive_basename
)
105 if not self
.relative
:
106 archive_root
= self
.bdist_dir
108 if (self
.distribution
.has_ext_modules() and
109 (install
.install_base
!= install
.install_platbase
)):
110 raise DistutilsPlatformError
, \
111 ("can't make a dumb built distribution where "
112 "base and platbase are different (%s, %s)"
113 % (repr(install
.install_base
),
114 repr(install
.install_platbase
)))
116 archive_root
= os
.path
.join(self
.bdist_dir
,
117 ensure_relative(install
.install_base
))
120 self
.make_archive(pseudoinstall_root
,
121 self
.format
, root_dir
=archive_root
)
123 if not self
.keep_temp
:
124 remove_tree(self
.bdist_dir
, dry_run
=self
.dry_run
)