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 *
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)"),
38 boolean_options
= ['keep-temp', 'skip-build']
40 default_format
= { 'posix': 'gztar',
45 def initialize_options (self
):
53 # initialize_options()
56 def finalize_options (self
):
58 if self
.bdist_dir
is None:
59 bdist_base
= self
.get_finalized_command('bdist').bdist_base
60 self
.bdist_dir
= os
.path
.join(bdist_base
, 'dumb')
62 if self
.format
is None:
64 self
.format
= self
.default_format
[os
.name
]
66 raise DistutilsPlatformError
, \
67 ("don't know how to create dumb built distributions " +
68 "on platform %s") % os
.name
70 self
.set_undefined_options('bdist',
71 ('dist_dir', 'dist_dir'),
72 ('plat_name', 'plat_name'))
79 if not self
.skip_build
:
80 self
.run_command('build')
82 install
= self
.reinitialize_command('install', reinit_subcommands
=1)
83 install
.root
= self
.bdist_dir
84 install
.skip_build
= self
.skip_build
87 log
.info("installing to %s" % self
.bdist_dir
)
88 self
.run_command('install')
90 # And make an archive relative to the root of the
91 # pseudo-installation tree.
92 archive_basename
= "%s.%s" % (self
.distribution
.get_fullname(),
95 # OS/2 objects to any ":" characters in a filename (such as when
96 # a timestamp is used in a version) so change them to hyphens.
98 archive_basename
= archive_basename
.replace(":", "-")
100 self
.make_archive(os
.path
.join(self
.dist_dir
, archive_basename
),
102 root_dir
=self
.bdist_dir
)
104 if not self
.keep_temp
:
105 remove_tree(self
.bdist_dir
, dry_run
=self
.dry_run
)