summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-03-31 02:55:12 (GMT)
committerGreg Ward <gward@python.net>2000-03-31 02:55:12 (GMT)
commit0f77f9569cffd512201089f086e230c789d09929 (patch)
treec90d0a070c2f5c4ea130fd030f4bfc88e5994ff3 /Lib
parent1aab6e964555bf615a853e86c1e2a26e28235803 (diff)
downloadcpython-0f77f9569cffd512201089f086e230c789d09929.zip
cpython-0f77f9569cffd512201089f086e230c789d09929.tar.gz
cpython-0f77f9569cffd512201089f086e230c789d09929.tar.bz2
The 'bdist' command, for creating "built" (binary) distributions.
Initial revision is pretty limited; it only knows how to generate "dumb" binary distributions, i.e. a tarball on Unix and a zip file on Windows. Also, due to limitations in the installation code, it only knows how to distribute Python library code. But hey, it's a start.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/command/bdist.py70
1 files changed, 70 insertions, 0 deletions
diff --git a/Lib/distutils/command/bdist.py b/Lib/distutils/command/bdist.py
new file mode 100644
index 0000000..5630828
--- /dev/null
+++ b/Lib/distutils/command/bdist.py
@@ -0,0 +1,70 @@
+"""distutils.command.bdist
+
+Implements the Distutils 'bdist' command (create a built [binary]
+distribution)."""
+
+# created 2000/03/29, Greg Ward
+
+__revision__ = "$Id$"
+
+import os, string
+from distutils.core import Command
+
+
+class bdist (Command):
+
+ description = "create a built (binary) distribution"
+
+ user_options = [('formats=', 'f',
+ "formats for distribution (tar, ztar, gztar, zip, ... )"),
+ ]
+
+ # This won't do in reality: will need to distinguish RPM-ish Linux,
+ # Debian-ish Linux, Solaris, FreeBSD, ..., Windows, Mac OS.
+ default_format = { 'posix': 'gztar',
+ 'nt': 'zip', }
+
+ format_command = { 'gztar': 'bdist_dumb',
+ 'zip': 'bdist_dumb', }
+
+
+ def initialize_options (self):
+ self.formats = None
+
+ # initialize_options()
+
+
+ def finalize_options (self):
+ if self.formats is None:
+ try:
+ self.formats = [self.default_format[os.name]]
+ except KeyError:
+ raise DistutilsPlatformError, \
+ "don't know how to create built distributions " + \
+ "on platform %s" % os.name
+ elif type (self.formats) is StringType:
+ self.formats = string.split (self.formats, ',')
+
+
+ # finalize_options()
+
+
+ def run (self):
+
+ for format in self.formats:
+ cmd_name = self.format_command[format]
+ sub_cmd = self.find_peer (cmd_name)
+ sub_cmd.set_option ('format', format)
+
+ # XXX blecchhh!! should formalize this: at least a
+ # 'forget_run()' (?) method, possibly complicate the
+ # 'have_run' dictionary to include some command state as well
+ # as the command name -- eg. in this case we might want
+ # ('bdist_dumb','zip') to be marked "have run", but not
+ # ('bdist_dumb','gztar').
+ self.distribution.have_run[cmd_name] = 0
+ self.run_peer (cmd_name)
+
+ # run()
+
+# class bdist