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 # created 2000/03/29, Greg Ward
12 from distutils
.core
import Command
13 from distutils
.util
import get_platform
14 from distutils
.dir_util
import create_tree
, remove_tree
15 from distutils
.errors
import *
17 class bdist_dumb (Command
):
19 description
= "create a \"dumb\" built distribution"
21 user_options
= [('bdist-dir=', 'd',
22 "temporary directory for creating the distribution"),
24 "platform name to embed in generated filenames "
25 "(default: %s)" % get_platform()),
27 "archive format to create (tar, ztar, gztar, zip)"),
29 "keep the pseudo-installation tree around after " +
30 "creating the distribution archive"),
32 "directory to put final built distributions in"),
35 boolean_options
= ['keep-temp']
37 default_format
= { 'posix': 'gztar',
41 def initialize_options (self
):
48 # initialize_options()
51 def finalize_options (self
):
53 if self
.bdist_dir
is None:
54 bdist_base
= self
.get_finalized_command('bdist').bdist_base
55 self
.bdist_dir
= os
.path
.join(bdist_base
, 'dumb')
57 if self
.format
is None:
59 self
.format
= self
.default_format
[os
.name
]
61 raise DistutilsPlatformError
, \
62 ("don't know how to create dumb built distributions " +
63 "on platform %s") % os
.name
65 self
.set_undefined_options('bdist',
66 ('dist_dir', 'dist_dir'),
67 ('plat_name', 'plat_name'))
74 self
.run_command('build')
76 install
= self
.reinitialize_command('install', reinit_subcommands
=1)
77 install
.root
= self
.bdist_dir
79 self
.announce("installing to %s" % self
.bdist_dir
)
80 self
.run_command('install')
82 # And make an archive relative to the root of the
83 # pseudo-installation tree.
84 archive_basename
= "%s.%s" % (self
.distribution
.get_fullname(),
86 self
.make_archive(os
.path
.join(self
.dist_dir
, archive_basename
),
88 root_dir
=self
.bdist_dir
)
90 if not self
.keep_temp
:
91 remove_tree(self
.bdist_dir
, self
.verbose
, self
.dry_run
)