Commit Graph

176 Commits

Author SHA1 Message Date
Éric Araujo 2fa0cbc9ae Remove buggy change for #13719 in packaging 2012-03-07 20:56:18 +01:00
Éric Araujo b8e280d225 Make packaging’ upload command work with bdist_msi products (#13719) 2012-03-05 17:04:07 +01:00
Éric Araujo 40e0f35ad5 Fix comparison bug with 'rc' versions in packaging.version (#11841).
I added some tests in 2105ab8553b7 and found no bug, but it turns out
that the doctest is not actually run.  While converting the doctest to
unittest style, I stumbled upon this bug again and this time applied the
code patch provided by Filip Gruszczyński.
2012-02-27 11:47:44 +01:00
Éric Araujo 7d32e7e5bc Port the #6884 fix to packaging 2012-02-26 04:01:34 +01:00
Éric Araujo 2180ee641c Fix code I unwittingly broke in b0e2d6592a1f (#14038) 2012-02-17 17:26:30 +01:00
Éric Araujo e8c5fdba30 Add test for packaging.util.set_platform (#13974).
Patch by Tshepang Lekhonkhobe.
2012-02-16 19:32:17 +01:00
Éric Araujo 43df889d63 Fix for packaging test failure on shared builds (#1326113) 2012-02-15 18:14:50 +01:00
Éric Araujo 4575afcb53 Fix parsing of packaging’s build_ext --libraries option (#1326113) 2012-02-15 17:25:25 +01:00
Éric Araujo 9f90a731eb Use sys.version_info instead of sys.version in packaging.
The contents of this attribute are an implementation detail, as
documented for #9442, so we should not parse it, to support non-CPython
VMs with distutils2 in the future.

Unfortunately, one use comes directly from PEP 345, so an edit will have
to be agreed before fixing the code (see comment in p7g.markers).

Other remaining uses are found in p7g.compiler and could be replaced by
the platform module (which also parses sys.version, but then it wouldn’t
be my fault :)
2012-02-10 05:20:53 +01:00
Éric Araujo 692a49394d Start improving 2to3 code in packaging (#13462).
- Change the fixers used in tests to something not provided by lib2to3
- Test conversion of doctests in text files
- Factor out test boilerplate into a common method
2012-02-09 21:37:14 +01:00
Éric Araujo 1a765f5d9d Synchronize packaging.tests.support with distutils2 2012-02-09 21:30:25 +01:00
Éric Araujo 6e1f564efa More boolean tests for packaging metadata environment markers 2012-02-09 21:18:26 +01:00
Éric Araujo 5c69b66086 Group commands by topic in “pysetup run --list-commands” output.
This fixes a regression from distutils, where “setup.py --help-commands”
prints out commands grouped by topic (i.e. building vs. installing),
which is more useful than using sorted.
2012-02-09 14:29:11 +01:00
Éric Araujo dcfcb64582 Stop converting package_data to extra_files in pysetup create (#13712).
pysetup create, the setup.cfg creation helper, used to convert
package_data (from an existing setup.py) into extra_files, the
replacement for MANIFEST.in, but these files are only present in sdists,
not installed: they don’t have the same use case at all, so converting
one into the other did not work.
2012-02-05 10:26:16 +01:00
Éric Araujo 31aefde876 Allow multiple values for package_data in setup.cfg (#11805).
Even though the resources system obsoletes data_files and package_data
(see bug discussion), package_data still exists to allow compatibility
with distutils and thus an easier transition.  In setup.py, the values
are lists of glob patterns, so the setup.cfg syntax needed a way to
express multiple values too.

Doc for this option will be added later as part of the big packaging doc
patches.  For now, the test serves as example.

Reported by Erik Bray.
2012-02-04 21:53:07 +01:00
Éric Araujo 591f6e82bd Improve one packaging test, remove a setuptoolism in another 2012-02-04 21:43:07 +01:00
Ned Deily 61c4e10035 Issue #13901: Prevent test_packaging failures on OS X with --enable-shared. 2012-02-03 02:46:37 +01:00
Éric Araujo 9b5c7f44fa Remove unused code from packaging.tests.__init__ 2011-11-15 10:48:36 +01:00
Éric Araujo 36500344b2 Remove redundant setUp/tearDown methods in packaging tests 2011-11-14 19:46:31 +01:00
Éric Araujo 618b73035a Add tests to check initial content of packaging.database caches 2011-11-14 19:43:37 +01:00
Éric Araujo e749e21948 packaging cleanup: A few super I missed in 5ae03b1e147a 2011-11-14 19:40:31 +01:00
Éric Araujo 0efc419d4a Adapt test and example after e39d1b6f0856.
Tarek’s commit fixed the way packaging configuration file markers are
split under Windows, but these two files were not edited.
2011-11-14 18:21:38 +01:00
Éric Araujo f8361623f0 Clean up byte-compilation code in packaging (#11254 followup).
- Don't use keyword arguments for debug_override; I find it more
  readable to have a comment explaining that True makes pyc and False
  pyo than to write out the non-obvious (when you haven’t read the doc)
  argument name

- Move duplicate code from build_py and install_lib into cmd

- Remove obsolete verbose argument of util.byte_compile

- Remove obsolete passing of -O/-OO to the Python process spawned by
  util.byte_compile (I’ll remove the whole spawning later, after I write
  more tests to check the contents of pyc and pyo files; now that
  byte_compile does not depend on the value of __debug__ in the calling
  Python, we can call py_compile or compileall directly)
2011-11-14 18:10:19 +01:00
Éric Araujo 438f21a406 Use more standard name for one option of packaging’s install_distinfo 2011-11-06 11:52:30 +01:00
Éric Araujo fad46e19b4 Clean up mocking of stdout and stdin in packaging tests.
Running with regrtest does not show spurious output or unrestored
sys.std* objects; sometimes running with make test is different, I’ll
watch the buildbots.

In addition, update the create module to use logging.
2011-11-06 11:32:47 +01:00
Éric Araujo 261ccdce48 Minor tweak to packaging tests.
When an option is changed on a command object, calling ensure_finalized
for a second time will not run finalize_options again, because
ensure_finalized is a no-op the second time.  By resetting the finalized
attribute, we can be sure that whatever computation takes place in
finalize_options will happen again.

(In test_command_clean, I removed two lines that were a no-op.)
2011-11-06 10:48:55 +01:00
Éric Araujo a963e0d917 Undo potentially confusing name change in packaging.
This method was named reinitialize_command in distutils and accompanied
by a comment suggesting to change it to get_reinitialized_command.
Following that, I did the change for distutils2, but it proved
confusing: The Distribution object has an internal cache of command
objects, to make sure only one instance is ever used, and the name
get_reinitialized_command could suggest that the object returned was
independent of that cache, which it was not.  I’m reverting the name
change to make code clearer.
2011-11-06 06:54:05 +01:00
Éric Araujo 4e377f215d Make sure packaging tests that register custom commands also clear them 2011-11-06 07:01:18 +01:00
Éric Araujo 03b0819389 Try to fix buildbot failures from #13193 2011-11-05 17:51:52 +01:00
Éric Araujo 7855a1abec Actually check the contents of the file created by packaging’s bdist_dumb 2011-11-03 06:00:02 +01:00
Éric Araujo 880801501b Improve byte-compilation in packaging to be independent of -O or -B.
The code I fixed to comply with PEP 3147 still had one bug: When run
under python -O, some paths for pyc files would be pyo, because I called
imp.cache_from_source without explicit debug_override argument in some
places, and under -O that would return .pyo (this is well explained in
the imp docs).  Now all code (util.byte_compile, build_py, install_lib)
can create .pyo files according to options given by users,
without interference from the calling Python’s own optimize mode.

On a related topic, I also removed the code that prevented byte
compilation under python -B.  The rationale is that packaging gives
control over the creation of pyc files to the user with its own explicit
option, and the behavior should not be changed if the calling Python
happens to run with -B for whatever reason.  I will argue that this is a
bug fix and ask to be allowed to backport this change to distutils.

Finally, I moved one nugget of information about the --compile and
--optimize options from the source into the doc.  It clears up a
misunderstanding that I (and maybe other people) had.
2011-11-03 05:08:28 +01:00
Éric Araujo dfd232898d Minor code reorganization in one packaging test file 2011-11-03 00:20:03 +01:00
Éric Araujo 89d3a69d83 Add tests for packaging.tests.support (#12659).
Thanks to Francisco Martín Brugué for the patch.
2011-10-21 07:56:32 +02:00
Éric Araujo f89ebdc358 Fix missing imports in setup scripts generated by packaging (#13205).
I’ve made more edits than the bug report suggested to make sure the
generated setup script is compatible with many Python versions; a
comment in the source explains that in detail.

The cfg_to_args function uses old 2.x idioms like codecs.open and
RawConfigParser.readfp because I want the setup.py generated by packaging and
distutils2 to be the same.  Most users won’t see the deprecation warning and I
ignore it in the test suite.

Thanks to David Barnett for the report and original patch.
2011-10-21 06:27:06 +02:00
Éric Araujo 3bb8be6d78 Branch merge 2011-10-19 21:32:39 +02:00
Éric Araujo f3f283a1cb Clean up some idioms in packaging tests.
- Use os.makedirs (I had forgotten about it!)
- Let TempdirManager.write_file call os.path.join for us
- Remove custom command added by test_dist
- Use a skip instead of hiding a method with an underscore
- Address pyflakes warnings
2011-10-19 08:49:20 +02:00
Éric Araujo 382067b3cf Change signature of packaging.tests.support.LoggingCatcher.get_logs.
I need this for some tests, and it makes code clearer.  This commit also
changes some assertEqual calls to use (actual, expected) order and fix
some pyflakes warnings.
2011-10-19 08:37:22 +02:00
Éric Araujo 4b5a5f7bd5 More fixes for PEP 3147 compliance in packaging (#11254) 2011-10-19 08:18:05 +02:00
Éric Araujo 8ccd18fff3 Expand tests and fix bugs in packaging.util.resolve_name.
The code is still ugly, but at least it works better now.  Patches to
make it easier to read are welcome, as well as support in #12915.
2011-10-19 06:46:13 +02:00
Łukasz Langa 318909b297 A ricochet from fixing #10680: http://http://example.com/ no longer reports
'nonnumeric port'. It parses to a host name of "http:" which is equivalent to
http:80.
2011-10-19 02:40:48 +02:00
Éric Araujo 8022314fc2 Cleanup in packaging: super considered super 2011-10-14 17:04:39 +02:00
Éric Araujo d139b99426 Fix writing of the RESOURCES file by packaging (#12386) 2011-10-14 16:58:23 +02:00
Éric Araujo aa2cb3a530 Increase test coverage for packaging.manifest (#11751).
Patch by Justin Love.
2011-10-11 03:06:16 +02:00
Éric Araujo 30cc65460e Add tests for Unicode handling in packaging’ check and register (#13114) 2011-10-11 02:18:12 +02:00
Éric Araujo a29e4f64c1 Fix packaging byte-compilation to comply with PEP 3147 (#11254).
I want to replace custom byte-compiling function with calls to
compileall before 3.3b1, but in the short term it’s good to have this
fixed.

Adapted from the distutils patch by Jeff Ramnani.  I tested with -B, -O
and -OO; test_util and test_mixin2to3 fail in -O mode because lib2to3
doesn’t support it.
2011-10-08 04:09:15 +02:00
Éric Araujo 73b1e7dd20 Make C code in one packaging test comply with ISO C (#10359).
Patch by Hallvard B Furuseth.
2011-10-08 02:58:50 +02:00
Éric Araujo 6fd287e6c2 Fix return code of “pysetup run COMMAND” (closes #12222) 2011-10-06 05:28:56 +02:00
Éric Araujo 8ed34a130e Minor: improve one test name, address pyflakes warnings 2011-10-06 05:18:41 +02:00
Éric Araujo fa23cc842c Add test that was promised in a comment but not actually written 2011-10-06 05:15:09 +02:00
Éric Araujo 9556a5bab2 Fix incorrect test.
The packaging.install.remove function (a.k.a. the uninstall feature)
takes a path argument to allow client code to use custom directories
instead of sys.path.  The test used to give self.root_dir as path, which
corresponds to a prefix option, but prefix is not on sys.path, it’s only
the base directory used to compute the stdlib and site-packages
directory paths.  The test now gives a valid site-packages path to the
function.
2011-10-06 05:10:09 +02:00