to 'msvc_prelink_hack()', adding the parameters that it actually needs,
and only calling it for MSVC compiler objects. Generally gave up on the
idea of a general "hook" mechanism: deleted the empty 'precompile_hook()'.
the "install_data" command to the installation base, which is usually just
sys.prefix. (Any setup scripts out there that specify data files will have
to set the installation directory, relative to the base, explicitly.)
in the module of the command classes that have command-specific
help options. This lets us keep the principle of lazily importing
the ccompiler module, and also gets away from defining non-methods
at class level.
'try_cpp()', 'search_cpp()', and 'check_header()'. This is enough that
the base config is actually useful for implementing a real config
command, specifically one for mxDateTime.
template into a new method 'prune_file_list()', called from
'get_file_list()' rather than 'read_manifest()' -- this keeps
'read_manifest()' more general.
Deleted the redundant call to 'exclude_pattern()' in 'make_distribution()'
-- this had the same intention as 'prune_file_list()', but was incomplete
(only pruned the release tree, not the build tree) and in the wrong
place (the prune wouldn't be reflected in the manifest file).
directly printing to stdout. This was a bit more work than it sounds like
it should have been:
* turned 'select_pattern()' and 'exclude_pattern()' from functions into
methods, so they can refer to 'self' to access the method
* commented out the *other* 'exclude_pattern()' method, which appears
to be vestigial code that was never cleaned up when the
'exclude_pattern()' function was created
* changed the one use of the old 'exclude_pattern()' method to use the
new 'exclude_pattern()' (same behaviour, slightly different args)
* some code and docstring reformatting
* and, of course, changed all the debugging prints to 'debug_print()' calls
Added/tweaked some regular ('self.announce()') output for better runtime
feedback.
values that "--foo" can take for various commands: eg. what formats for
"sdist" and "bdist", what compilers for "build_ext" and "build_clib".
I have *not* reviewed this patch; I'm checking it in as-is because it also
fixes a paper-bag-over-head bug in bdist.py, and because I won't have
time to review it properly for several days: so someone else can
test it for me, instead!
one doesn't *do* anything by default; it's just there as a conduit for data
(eg. include dirs, libraries) from the user to the "build" commands.
However, it provides a couple of Autoconf-ish methods ('try_compile()',
'try_link()', 'try_run()') that derived, per-distribution "config" commands
can use to poke around the target system and see what's available.
Initial experimenst with mxDateTime indicate that higher-level methods are
necessary: analogs of Autoconf's AC_CHECK_HEADER, AC_CHECK_LIB will be
needed too (and that's just to probe the C/C++ system: how to probe the
Python system is wide open, and someday we'll have to worry about probing a
Java system too).
Half-fixed RPM 2 compatibility:added 'rpm_base' option, which must be set
(to eg. /usr/src/redhat on a stock Red Hat system) if rpm2_mode is on.
Still not quite working, though.
Fills in question marks in help
Reads scripts in from files rather than strings
Adds RPM 2 compatibility mode (untested). Use of this mode requires that
--bdist-base be specified because bdist_rpm has no way of detecting where
RPM wants to find spec files and source files. An unmodified RedHat 5.0
system would require '--bdist-base=/usr/src/RedHat'. (You would also have
to be root.) If the rpmrc file has been modified to allow RPMs to be built
by normal users then --build-base would need to be changed accordingly.
Formats the changelog.
GPW: tweaked formatting, added some editorial comments.
prep/build/etc. scripts, doc files, dependency info) from a config file
rather than the dedicated "package_info" file. (The idea is that
developers will provide RPM-specific info in the "[bdist_rpm]" section of
setup.cfg, but of course it could also be supplied in the other config
files, on the command line, or in the setup script -- or any mix of the
above.)
Major changes:
* added a boatload of options to 'user_options' and
'initialize_options()': 'distribution_name', 'group', 'release', ...
* added 'finalize_package_data()', which takes the place of
'_get_package_data()' -- except it's called from 'finalize_options()',
not 'run()', so we have everything figured out before we actually run
the command
* added 'ensure_string()', 'ensure_string_list()', 'ensure_filename()';
these take the place of '_check_string()' and friends. (These actually
look like really useful type-checking methods that could come in handy
all over the Distutils; should consider moving them up to Command and
using them in other command classes' 'finalize_options()' method for
error-checking).
* various cleanup, commentary, and adaptation to the new way of
storing RPM info in '_make_spec_file()'
* added "--bdist-base" option to parameterize where we build
the RPM (comes from "bdist" by default: "build/bdist.<plat>")
* simplified/cleaned up some code in 'run()' in the process of
removing (most) hard-coded directory names
* if "--spec-only", drop spec file in "dist" rather than "redhat"
(directory name still hard-coded, though)
* use 'reinitialize_command()' to fetch the "sdist" object to
tweak before running "sdist" command
* use 'self.copy_file()' method rather than 'copy_file()' function
* cosmetic tweaks to comments, error messages
* help strings start with lowercase
* added affirmative version of '--no-clean' and '--no-rpm-opt-flags',
which are the default (thus the attributes that correspond to
the options are now 'clean' and 'use_rpm_opt_flags')
setup script) to be a list of Extension instances, rather than a list of of
(ext_name, build_info) tuples. This is mostly a simplification, but
'check_extension_list()' got a lot more complicated because of the need to
convert the old-style tuples to Extension instances.
Temporarily dropped support for defining/undefining macros in the
'extensions' list -- I want to change the interface, but haven't yet made
the required changes in CCompiler and friends to support this nicely.
Also neatened up the code that merges 'extra_compile_flags' and the CFLAGS
environment variable.
* Command method 'find_peer()' -> 'get_finalized_command()'
* Command method 'run_peer()' -> 'run_command()'
Also deleted the 'get_command_option()' method from Command, and
fixed the one place where it was used (in "bdist_dumb").
directories after all is said and done, so we don't accidentally include
those files in the source distribution.
(This is the quick and easy way to fix this; Andrew says: "Changing
findall() looked like it was going to be messy, so I tried this instead.
The only problem is that redundant directory traversals are being done,
walking through build/ only to throw out all the files found at the end.").
* 'headers' entry added to all the install schemes
* '--install-headers' option added
* 'install_headers' added to 'sub_commands'
* added 'dist_name' to configuration variables (along with a few
others that seem handy: 'dist_version', 'dist_fullname', and
'py_version'
* in 'finalize_unix()', make sure 'install_headers' defined if
user specified 'install_base' and/or 'install_platbase'
* added 'has_headers()'
* a few other small changes
attempt to verify the bold assertions in the documentation):
* entries for the "root package" in 'package_dir' didn't work --
fixed by improving the fall-through code in 'get_package_dir()'
* __init__.py files weren't installed when modules-in-packages
were listed individually (ie. in 'py_modules' in the setup script);
fixed by making 'check_package()' return the name of the __init__
file if it exists, and making 'find_modules()' add an entry to
the module list for __init__ if applicable
* 'first_line_re' loosened up
* command description improved
* replaced '_copy_files()' and '_adjust_files()' with one method
that does everything, 'copy_scripts()' -- this should be more
efficient than Bastian's version, should behave better in
dry-run mode, and does timestamp dependency-checking
necessary to support it.
Details:
- build command additionally calls build_scripts
- build_scripts builds your scripts in 'build/scripts' and adjusts the
first line if it begins with "#!" and ends with "python", optionally
ending with commandline options (like -O, -t ...). Adjusting means we
write the current path to the Python interpreter in the first line.
- install_scripts copies the scripts to the install_scripts dir
- install_data copies your data_files in install_data. You can
supply individual directories for your data_files:
data_files = ['doc/info.txt', # copy this file in install_scripts dir
('testdata', ['a.dat', 'b.dat']), # copy these files in
# install_scripts/testdata
('/etc', ['packagerc']), # copy this in /etc. When --root is
# given, copy this in rootdir/etc
]
So you can use the --root option with absolute data paths.
objects, it now has method names.
Added three methods, 'has_lib()', 'has_scripts()', and 'has_data()'
to determine if we need to run each of the three possible sub-commands.
Added 'get_sub_commands()' to take care of finding the methods named
in 'sub_commands', running them, and interpreting the results to
build a list of sub-commands that actually have to be run.
new flexibility, specifically the 'root' option. Now, we just use
"install" to do a fake installation into a temporary directory
(the 'bdist_dir' option, which derives from the 'bdist_base' option of
"bdist"), and then tar/zip up that directory. This means that dumb
built distributions are now relative to the root directory, rather than
the prefix or exec-prefix; this is probably a feature, but does make
them slightly less flexible.
top-level temporary directory for creating built distributions. (Won't
work yet, since the "build" command doesn't yet have a 'build_bdist'
option, and none of the "bdist" commands support it yet.)
adds the 'install_data' and 'install_scripts' commands; these two
are trivial thanks to the 'install_misc' base class in cmd.py.
(Minor tweaks and commentary by me; the code is untested so far.)
Also added creation of 'implib_dir', a temporary directory specific to
MSVC++ -- but I checked in two ways of fixing it (Lyle's and mine),
because I'm not sure which is right.
in command-line options, and in two phases at that: first, we expand
'install_base' and 'install_platbase', and then the other 'install_*'
options. This lets us do tricky stuff like
install --prefix='/tmp$sys_prefix'
...oooh, neat.
Simplified 'select_scheme()' -- it's no longer responsible for expanding
config vars, tildes, etc.
Define installation-specific config vars in 'self.config_vars', rather than
in a local dictionary of one method. Also factored '_expand_attrs()' out
of 'expand_dirs()' and added 'expand_basedirs()'.
Added a bunch of debugging output so I (and others) can judge the
success of this crazy scheme through direct feedback.
Adds bztar format to generate .tar.bz2 tarballs
Uses the -f argument to overright old tarballs automatically, I am
assuming that if the old tarball was wanted it would have been moved or
else the version number would have been changed.
Uses the -9 argument to bzip2 and gzip to use maximum
compression. Compress uses the maximum compression by default.
Tests for correct value for the 'compress' argument of make_tarball. This
is one less place for someone adding new compression programs to forget to
change.
- DistutilsOptionError is now documented as it's actually used, ie.
to indicate bogus option values (usually user options, eg. from
the command-line)
- added DistutilsSetupError to indicate errors that definitely arise
in the setup script
- got rid of DistutilsValueError, and changed all usage of it to
either DistutilsSetupError or ValueError as appropriate
- simplified a bunch of option get/set methods in Command and
Distribution classes -- just pass on AttributeError most of
the time, rather than turning it into something else
Added code to include source files from 'build_clib' command to default file
list -- currently this won't work, since 'build_clib' doesn't have a
'get_source_files()' method!
* build to "Debug" or "Release" temp directory
* put linker turds (.lib and .exp files) in the build temp directory
* tack on "_d" to extensions built with debugging
* added 'get_ext_libname()' help in putting linker turds to temp dir
Also, moved the code that simplifies None to empty list for a bunch
of options to 'finalize_options()' instead of 'run()'.
the command that actually creates "dumb" binary distributions, ie.
tarballs and zip files that you just unpack under <prefix> or <exec-prefix>.
Very limited, but it's a start.
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.
provided by Distribution.
Cosmetic and error message tweaks.
Simplified 'make_release_tree()':
* extracted 'distutils.util.create_tree()'
* don't have to do hard-linking ourselves -- it's now handled by
'distutils.util.copy_file()' (although the detection of
whether hard linking is available still needs to be factored out)
Removed 'make_tarball()' and 'make_zipfile()' entirely -- their role
is now amply filled by 'distutils.util.make_archive()'.
Simplified 'make_distribution()':
* use Distribution's new 'get_full_name()' method
* use 'make_archive()' instead of if/elif/.../else on the archive format
is responsible for installing all Python modules (pure and extensions).
Added 'get_outputs()' in preparation for the 'bdist' command, and
'_mutate_outputs()' to support 'get_outputs()'.
in a class attribute 'sub_commands', rather than hard-coded in 'run()'.
This should make it easier to subclass 'install', and also makes it
easier to keep 'run()' and the new 'get_outputs()' consistent.
Added 'get_outputs()' in preparation for the 'bdist' command.
Changed signature of 'build_extensions()': no longer takes the extension
list, but uses 'self.extensions' (just like 'get_outputs()' has to)
Moved call to 'check_extensions_list()' from 'run()' to 'build_extensions()',
again for consistency with 'get_outputs()'.
A host of improvements in preparation for the 'bdist' command:
- added 'get_outputs()' method (all the other improvements were to support
this addition)
- made 'find_package_modules()' and 'find_modules()' return similar
values (list of (package, module, module_filename) tuples)
- factored 'find_all_modules()' out of 'get_source_files()' (needed
by 'get_outputs()')
- factored 'get_module_outfile()' out of 'build_module()' (also needed
by 'get_outputs()')
- various little tweaks, improvements, comment/doc updates
these must come from the 'build' command. This means we no longer need
the misconceived 'set_peer_option()' method in Command and, more importantly,
sweeps away a bunch of potential future complexity to handle this tricky
case.
this command for a while; this implements roughly the plan cooked up by
Guido, Fred, and me. Seems to strike a nice balance between usability in
the common cases (just set one option), expandability for more types of
files to install in future, and customizability of installation
directories.
This revision isn't completely working: standard and alternate
installations work fine, but there are still some kinks to work out of
customized installations.
* improve help strings
* warn if user supplies non-existing directories
* don't try to 'remove_tree()' non-existing directories
* try to remove the build_base after cleanup (but don't do or say
anything if it fails -- this is just in case we made it empty)
* replaced build_lib.py with build_clib.py
* renamed the class in build_clib.py
* changed all references to 'build_lib' command in other command classes
when building extensions (uses build_lib's 'get_library_names()' method).
Ensure that the relative structure of source filenames is preserved in
the temporary build tree, eg. foo/bar.c compiles to
build/temp.<plat>/foo/bar.o.
Added 'build_clib' and 'build_temp' options (where to put C libraries
and where to put temporary compiler by-products, ie. object files).
Moved the call to 'check_library_list()' from 'run()' to 'finalize_options()'
-- that way, if we're going to crash we do so earlier, and we guarantee
that the library list is valid before we do anything (not just run).
Disallow directory separators in library names -- the compiled library
always goes right in 'build_clib'.
Added 'get_library_names()', so the "build_ext" command knows what
libraries to link every extension with.
* 'build_dir' -> 'build_lib', which by default takes its value
straight from 'build_lib' in the 'build' command
* added 'build_temp' and 'inplace' options
* change 'build_extensions()' to put object files (compiler turds) in
'build_temp' dir
* complicated the name-of-extension-file shenanigans in
'build_extensions()' to support "in-place" extension building, i.e.
put the extension right into the source tree (handy for developers)
* added 'get_ext_fullname()', renamed 'extension_filename()' to
'get_ext_filename()', and tweaked the latter a bit -- all to support
the new filename shenanigans
old 'dist' command, but the code for dealing with manifests is completely
redone -- and renaming the command to 'sdist' is more symmetric with the
soon-to-exist 'bdist' command.
'--help-commands' option).
Shuffled imports around in a few command modules to avoid expensive
up-front import of sysconfig (and resulting delays in generating list
of all commands).
Added 'nuke_release_tree()' method to blow away the directory from
which the archive file(s) are created, and call it (conditionally)
from 'make_distribution()'.
Added 'keep_tree' option (false by default) to disable the call to
'nuke_release_tree()'.
install) the setup script itself.
Fixed 'build_module()' so we do *not* preserve file mode (which means
we can install read-only files, which makes the next installation
of this distribution fail -- at least under Unix); added a comment
explaining this.
Bunch of little bug fixes that appeared in building non-packagized
distributions. Mainly:
- brain-slip typo in 'get_package_dir()'
- don't try to os.path.join() an empty path tuple -- it doesn't like it
- more type-safety in 'build_module()'
Now supports the full range of intended formats (tar, ztar, gztar, zip).
"-f" no longer a short option for "--formats" -- conflicts with new
global option "--force"!
Catch up with renamed 'platdir' -> 'build_platlib' option in 'build'.
Don't call 'set_final_options()' in 'run()' anymore -- that's now
guaranteed to be taken care of for us by the Distribution instance.
If 'include_dirs' is a string, split it on os.pathsep (this is half-
hearted -- support for setting compile/link options on the command
line is totally lame and probably won't work at all).
Added 'get_source_files()' for use by 'dist' command.
Added code to 'build_extensions()' to figure out the "def file" to use
with MSVC++ and add it to the linker command line as an "extra_postarg".
Don't call 'set_final_options()' in 'run()' anymore -- that's now
guaranteed to be taken care of for us by the Distribution instance.
Rearranged to bit to allow outsiders (specifically, the 'dist' command)
to find out what modules we would build:
- 'find_modules()' renamed to 'find_package_modules()'
- most of 'build_modules()' abstracted out to 'find_modules()'
- added 'get_source_files()' (for the 'dist' command to use)
- drastically simplified 'build_modules()' -- now just a wrapper around
'find_modules()' and 'build_module()'
Tweaked some help strings to be consistent with documentation.
Don't call 'set_final_options()' in 'run()' anymore -- that's now
guaranteed to be taken care of for us by the Distribution instance.
distributions their own directory (and .pth file).
Overhauled how we determine installation directories in
'set_final_options()' to separate platform-dependence and take
'install_path' option into account.
Added 'create_path_file()' to create path config file when 'install_path'
given.
Only run 'install_py' and 'install_ext' when, respectively, there are
some pure Python modules and some extension modules in the distribution.
- rename 'dir' to 'build_dir'
- take 'package' from distribution option 'ext_package'
- take 'extensions' from distribution option 'ext_modules'
- take 'include_dirs' from distribution
Name keyword args explictly when calling CCompiler methods.
Overhauled how we generate extension filenames (in 'extension_filename()
and 'build_extension()') to take 'package' option into account.
'install_site_lib' and install_site_platlib' on non-POSIX platforms.
Should at least work for NT, as this is adopted from Amos Latteier's NT
patches. Also added extensive comments bitching about the inadequacy of
the current model, both under POSIX and NT (and probably other) systems.
of the 'install_py' command rather than 'build_py'. Obviously, this
meant that the 'build_py' and 'install_py' modules had to change; less
obviously, so did 'install' and 'build', since these higher-level
commands must make options available to control the lower-level
commands, and some compilation-related options had to migrate with the
code.