At 05:43 AM 5/18/2004, David Handy wrote:
>On Tue, 18 May 2004, Floris van der Tak wrote:
>
>> my attempt to install the distutils on suse 9.0 (which provides python
>> 2.3) fails:
>
>Why are you installing distutils on a system that already has Python 2.3
>installed? Python 2.3 normally comes with distutils as part of the Python
>standard library.
>
>Did suse distribute a version of Python that had distutils removed?
It should come from python-devel
Hi again --
[cc'd to Paul Dubois: you said you weren't following the distutils sig
anymore, but this directly concerns NumPy and I'd like to get your
input!]
here's that sample setup.py for NumPy. See below for discussion (and
questions!).
------------------------------------------------------------------------
#!/usr/bin/env python
# Setup script example for building the Numeric extension to Python.
# This does sucessfully compile all the .dlls. Nothing happens
# with the .py files currently.
# Move this file to the Numerical directory of the LLNL numpy
# distribution and run as:
# python numpysetup.py --verbose build_ext
#
# created 1999/08 Perry Stoll
__rcsid__ = "$Id: numpysetup.py,v 1.1 1999/09/12 20:42:48 gward Exp $"
from distutils.core import setup
setup (name = "numerical",
version = "0.01",
description = "Numerical Extension to Python",
url = "http://www.python.org/sigs/matrix-sig/",
ext_modules = [ ( '_numpy', { 'sources' : [ 'Src/_numpymodule.c',
'Src/arrayobject.c',
'Src/ufuncobject.c'
],
'include_dirs' : ['./Include'],
'def_file' : 'Src/numpy.def' }
),
( 'multiarray', { 'sources' : ['Src/multiarraymodule.c'],
'include_dirs' : ['./Include'],
'def_file': 'Src/multiarray.def'
}
),
( 'umath', { 'sources': ['Src/umathmodule.c'],
'include_dirs' : ['./Include'],
'def_file' : 'Src/umath.def' }
),
( 'fftpack', { 'sources': ['Src/fftpackmodule.c', 'Src/fftpack.c'],
'include_dirs' : ['./Include'],
'def_file' : 'Src/fftpack.def' }
),
( 'lapack_lite', { 'sources' : [ 'Src/lapack_litemodule.c',
'Src/dlapack_lite.c',
'Src/zlapack_lite.c',
'Src/blas_lite.c',
'Src/f2c_lite.c'
],
'include_dirs' : ['./Include'],
'def_file' : 'Src/lapack_lite.def' }
),
( 'ranlib', { 'sources': ['Src/ranlibmodule.c',
'Src/ranlib.c',
'Src/com.c',
'Src/linpack.c',
],
'include_dirs' : ['./Include'],
'def_file' : 'Src/ranlib.def' }
),
]
)
------------------------------------------------------------------------
First, what d'you think? Too clunky and verbose? Too much information
for each extension? I kind of think so, but I'm not sure how to reduce
it elegantly. Right now, the internal data structures needed to compile
a module are pretty obviously exposed: is this a good thing? Or should
there be some more compact form for setup.py that will be expanded later
into the full glory we see above?
I've already made one small step towards reducing the amount of cruft by
factoring 'include_dirs' out and supplying it directly as a parameter to
'setup()'. (But that needs code not in the CVS archive yet, so I've
left the sample setup.py the same for now.)
The next thing I'd like to do is get that damn "def_file" out of there.
To support it in MSVCCompiler, there's already an ugly hack that
unnecessarily affects both the UnixCCompiler and CCompiler classes, and
I want to get rid of that. (I refer to passing the 'build_info'
dictionary into the compiler classes, if you're familiar with the code
-- that dictionary is part of the Distutils extension-building system,
and should not propagate into the more general compiler classes.)
But I don't want to give these weird "def file" things standing on the
order of source files, object files, libraries, etc., because they seem
to me to be a bizarre artifact of one particular compiler, rather than
something present in a wide range of C/C++ compilers.
Based on the NumPy model, it seems like there's a not-too-kludgy way to
handle this problem. Namely:
if building extension "foo":
if file "foo.def" found in same directory as "foo.c"
add "/def:foo.def" to MSVC command line
this will of course require some platform-specific code in the build_ext
command class, but I figured that was coming eventually, so why put it
off? ;-)
To make this hack work with NumPy, one change would be necessary: rename
Src/numpy.def to Src/_numpy.def to match Src/_numpy.c, which implements
the _numpy module. Would this be too much to ask of NumPy? (Paul?)
What about other module distributions that support MSVC++ and thus ship
with "def" files? Could they be made to accomodate this scheme?
Thanks for your feedback --
Greg
--
Greg Ward - software developer gward(a)cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
Hi all --
at long last, I found the time to hack in the ability to compile
extension modules to the Distutils. Mainly, this meant adding a
'build_ext' command which uses a CCompiler instance for all its dirty
work. I also had to add a few methods to CCompiler (and, of course,
UnixCCompiler) to make this work.
And I added a new module, 'spawn', which takes care of running
sub-programs more efficiently and robustly (no shell involved) than
os.system. That's needed, obviously, so we can run the compiler!
If you're in the mood for grubbing over raw source code, then get the
latest from CVS or download a current snapshot. See
http://www.python.org/sigs/distutils-sig/implementation.html
for a link to the code snapshot.
I'm still waiting for more subclasses of CCompiler to appear. At the
very least, we're going to need MSVCCompiler to build extensions on
Windows. Any takers? Also, someone who knows the Mac, and how to run
compilers programmatically there, will have to figure out how to write a
Mac-specific concrete CCompiler subclass.
The spawn module also needs a bit of work to be portable. I suspect
that _win32_spawn() (the intended analog to my _posix_spawn()) will be
easy to implement, if it even needs to go in a separate function at all.
It looks from the Python Library documentation for 1.5.2 that the
os.spawnv() function is all we need, but it's a bit hard to figure out
just what's needed. Windows wizards, please take a look at the
'spawn()' function and see if you can make it work on Windows.
As for actually compiling extensions: well, if you can figure out the
build_ext command, go ahead and give it a whirl. It's a bit cryptic
right now, since there's no documentation and no example setup.py. (I
have a working example at home, but it's not available online.) If you
feel up to it, though, see if you can read the code and figure out
what's going on. I'm just hoping *I'll* be able to figure out what's
going on when I get back from the O'Reilly conference next week... ;-)
Enjoy --
Greg
--
Greg Ward - software developer gward(a)cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
Hi all --
at long last, I have fixed two problems that a couple people noticed a
while ago:
* I folded in Amos Latteier's NT patches almost verbatim -- just
changed an `os.path.sep == "/"' to `os.name == "posix"' and added
some comments bitching about the inadequacy of the current library
installation model (I think this is Python's fault, but for now
Distutils is slavishly aping the situation in Python 1.5.x)
* I fixed the problem whereby running "setup.py install" without
doing anything else caused a crash (because 'build' hadn't yet
been run). Now, the 'install' command automatically runs 'build'
before doing anything; to make this bearable, I added a 'have_run'
dictionary to the Distribution class to keep track of which commands
have been run. So now not only are command classes singletons,
but their 'run' method can only be invoked once -- both restrictions
enforced by Distribution.
The code is checked into CVS, or you can download a snapshot at
http://www.python.org/sigs/distutils-sig/distutils-19990607.tar.gz
Hope someone (Amos?) can try the new version under NT. Any takers for
Mac OS?
BTW, all parties involved in the Great "Where Do We Install Stuff?"
Debate should take a good, hard look at the 'set_final_options()' method
of the Install class in distutils/install.py; this is where all the
policy decisions about where to install files are made. Currently it
apes the Python 1.5 situation as closely as I could figure it out.
Obviously, this is subject to change -- I just don't know to *what* it
will change!
Greg
--
Greg Ward - software developer gward(a)cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
Hi all,
I've been aware that the distutils sig has been simmerring away, but
until recently it has not been directly relevant to what I do.
I like the look of the proposed api, but have one question. Will this
support an installed system that has multiple versions of the same
package installed simultaneously? If not, then this would seem to be a
significant limitation, especially when dependencies between packages
are considered.
Assuming it does, then how will this be achieved? I am presently
managing this with a messy arrangement of symlinks. A package is
installed with its version number in it's name, and a separate
directory is created for an application with links from the
unversioned package name to the versioned one. Then I just set the
pythonpath to this directory.
A sample of what the directory looks like is shown below.
I'm sure there is a better solution that this, and I'm not sure that
this would work under windows anyway (does windows have symlinks?).
So, has this SIG considered such versioning issues yet?
Cheers,
Tim
--------------------------------------------------------------
Tim Docker timd(a)macquarie.com.au
Quantative Applications Division
Macquarie Bank
--------------------------------------------------------------
qad16:qad $ ls -l lib/python/
total 110
drwxr-xr-x 2 mts mts 512 Nov 11 11:23 1.1
-r--r----- 1 root mts 45172 Sep 1 1998 cdrmodule_0_7_1.so
drwxr-xr-x 2 mts mts 512 Sep 1 1998 chart_1_1
drwxr-xr-x 3 mts mts 512 Sep 1 1998 Fnorb_0_7_1
dr-xr-x--- 3 mts mts 512 Nov 11 11:21 Fnorb_0_8
drwxr-xr-x 3 mts mts 1536 Mar 3 12:45 mts_1_1
dr-xr-x--- 7 mts mts 512 Nov 11 11:22 OpenGL_1_5_1
dr-xr-x--- 2 mts mts 1024 Nov 11 11:23 PIL_0_3
drwxr-xr-x 3 mts mts 512 Sep 1 1998 Pmw_0_7
dr-xr-x--- 2 mts mts 512 Nov 11 11:21 v3d_1_1
qad16:qad $ ls -l lib/python/1.1
total 30
lrwxrwxrwx 1 root other 29 Apr 10 10:43 _glumodule.so -> ../OpenGL_1_5_1/_glumodule.so
lrwxrwxrwx 1 root other 30 Apr 10 10:43 _glutmodule.so -> ../OpenGL_1_5_1/_glutmodule.so
lrwxrwxrwx 1 root other 22 Apr 10 10:43 _imaging.so -> ../PIL_0_3/_imaging.so
lrwxrwxrwx 1 root other 36 Apr 10 10:43 _opengl_nummodule.so -> ../OpenGL_1_5_1/_opengl_nummodule.so
lrwxrwxrwx 1 root other 27 Apr 10 10:43 _tkinter.so -> ../OpenGL_1_5_1/_tkinter.so
lrwxrwxrwx 1 mts mts 21 Apr 10 10:43 cdrmodule.so -> ../cdrmodule_0_7_1.so
lrwxrwxrwx 1 mts mts 12 Apr 10 10:43 chart -> ../chart_1_1
lrwxrwxrwx 1 root other 12 Apr 10 10:43 Fnorb -> ../Fnorb_0_8
lrwxrwxrwx 1 mts mts 12 Apr 10 10:43 mts -> ../mts_1_1
lrwxrwxrwx 1 root other 15 Apr 10 10:43 OpenGL -> ../OpenGL_1_5_1
lrwxrwxrwx 1 root other 33 Apr 10 10:43 opengltrmodule.so -> ../OpenGL_1_5_1/opengltrmodule.so
lrwxrwxrwx 1 root other 33 Apr 10 10:43 openglutil_num.so -> ../OpenGL_1_5_1/openglutil_num.so
lrwxrwxrwx 1 root other 10 Apr 10 10:43 PIL -> ../PIL_0_3
lrwxrwxrwx 1 mts mts 10 Apr 10 10:43 Pmw -> ../Pmw_0_7
lrwxrwxrwx 1 root other 10 Apr 10 10:43 v3d -> ../v3d_1_1
On Fri Oct 22 00:42:47 CEST 2004 Mark W. Alexander wrote:
> I'm chomping to do a bdist_deb, but sitting on my hands hoping someone
> who can contribute it will do it first.
I've got one that pretty-much works. I'd be happy to get rid
of the last couple peculiarities that I know of and massage
it into a patch on CVS as long as someone assures me that
there's a decent chance the patch will be accepted.
Best Regards,
Jeff Dairiki
This announcement is available in HTML at:
http://bob.pythonmac.org/archives/2004/12/30/ann-py2app-017/
`py2app`_ is the bundlebuilder replacement we've all been waiting for.
It is implemented as a distutils command, similar to `py2exe`_, that
builds Mac OS X applications from Python scripts, extensions, and
related data files. It tries very hard to include all dependencies it
can find so that your application can be distributed standalone, as Mac
OS X applications should be.
`py2app`_ 0.1.7 is included in the installer for `PyObjC`_ 1.2. If you
have
installed `PyObjC`_ 1.2, then you already have `py2app`_ 0.1.7
installed.
Download and related links are here: http://undefined.org/python/#py2app
`py2app`_ 0.1.7 is a bug fix release:
* The ``bdist_mpkg`` script will now set up sys.path properly, for
setup scripts
that require local imports.
* ``bdist_mpkg`` will now correctly accept ``ReadMe``, ``License``,
``Welcome``,
and ``background`` files by parameter.
* ``bdist_mpkg`` can now display a custom background again (0.1.6
broke this).
* ``bdist_mpkg`` now accepts a ``build-base=`` argument, to put build
files in
an alternate location.
* ``py2app`` will now accept main scripts with a ``.pyw`` extension.
* ``py2app``'s not_stdlib_filter will now ignore a ``site-python``
directory as
well as ``site-packages``.
* ``py2app``'s plugin bundle template no longer displays GUI dialogs
by default,
but still links to ``AppKit``.
* ``py2app`` now ensures that the directory of the main script is now
added to
``sys.path`` when scanning modules.
* The ``py2app`` build command has been refactored such that it would
be easier
to change its behavior by subclassing.
* ``py2app`` alias bundles can now cope with editors that do atomic
saves
(write new file, swap names with existing file).
* ``macholib`` now has minimal support for fat binaries. It still
assumes big
endian and will not make any changes to a little endian header.
* Add a warning message when using the ``install`` command rather
than installing
from a package.
* New ``simple/structured`` example that shows how you could package
an
application that is organized into several folders.
* New ``PyObjC/pbplugin`` Xcode Plug-In example.
Since I have been slacking and the last announcement was for 0.1.4,
here are the
changes for the soft-launched releases 0.1.5 and 0.1.6:
`py2app`_ 0.1.6 was a major feature enhancements release:
* ``py2applet`` and ``bdist_mpkg`` scripts have been moved to Python
modules
so that the functionality can be shared with the tools.
* Generic graph-related functionality from ``py2app`` was moved to
``altgraph.ObjectGraph`` and ``altgraph.GraphUtil``.
* ``bdist_mpkg`` now outputs more specific plist requirements
(for future compatibility).
* ``py2app`` can now create plugin bundles (MH_BUNDLE) as well as
executables.
* New recipe for supporting extensions built with `sip`_, such as
`PyQt`_. Note that
due to the way that `sip`_ works, when one sip-based extension is
used, *all*
sip-based extensions are included in your application. In
practice, this means
anything provided by `Riverbank`_, I don't think anyone else uses
`sip`_ (publicly).
* New recipe for `PyOpenGL`_. This is very naive and simply includes
the whole
thing, rather than trying to monkeypatch their brain-dead
version acquisition routine in ``__init__``.
* Bootstrap now sets ``ARGVZERO`` and ``EXECUTABLEPATH`` environment
variables,
corresponding to the ``argv[0]`` and the
``_NSGetExecutablePath(...)`` that the
bundle saw. This is only really useful if you need to relaunch
your own
application.
* More correct ``dyld`` search behavior.
* Refactored ``macholib`` to use ``altgraph``, can now generate
`GraphViz`_ graphs
and more complex analysis of dependencies can be done.
* ``macholib`` was refactored to be easier to maintain, and the
structure handling
has been optimized a bit.
* The few tests that there are were refactored in `py.test`_ style.
* New `PyQt`_ example.
* New `PyOpenGL`_ example.
`py2app`_ 0.1.5 was a major feature enhancements release:
* Added a ``bdist_mpkg`` distutils extension, for creating Installer
an metapackage from any distutils script.
- Includes PackageInstaller tool
- bdist_mpkg script
- setup.py enhancements to support bdist_mpkg functionality
* Added a ``PackageInstaller`` tool, a droplet that performs the same
function
as the ``bdist_mpkg`` script.
* Create a custom ``bdist_mpkg`` subclass for `py2app`_'s setup
script.
* Source package now includes `PJE`_'s `setuptools`_ extension to
distutils.
* Added lots of metadata to the setup script.
* ``py2app.modulegraph`` is now a top-level package, ``modulegraph``.
* ``py2app.find_modules`` is now ``modulegraph.find_modules``.
* Should now correctly handle paths (and application names) with
unicode characters
in them.
* New ``--strip`` option for ``py2app`` build command, strips all
Mach-O files
in output application bundle.
* New ``--bdist-base=`` option for ``py2app`` build command, allows
an alternate
build directory to be specified.
* New `docutils`_ recipe.
* Support for non-framework Python, such as the one provided by
`DarwinPorts`_.
.. _`py.test`: http://codespeak.net/py/current/doc/test.html
.. _`GraphViz`: http://www.pixelglow.com/graphviz/
.. _`PyOpenGL`: http://pyopengl.sf.net/
.. _`Riverbank`: http://www.riverbankcomputing.co.uk/
.. _`sip`: http://www.riverbankcomputing.co.uk/sip/index.php
.. _`PyQt`: http://www.riverbankcomputing.co.uk/pyqt/index.php
.. _`DarwinPorts`: http://darwinports.opendarwin.org/
.. _`docutils`: http://docutils.sf.net/
.. _`setuptools`: http://cvs.eby-sarna.com/PEAK/setuptools/
.. _`PJE`: http://dirtSimple.org/
.. _`py2app`: http://undefined.org/python/#py2app
.. _`py2exe`: http://starship.python.net/crew/theller/py2exe/
.. _`PyObjC`: http://pyobjc.sf.net/
One of the trickier things about defining our "plugin" format is the
definition of a platform. That is, how can we tell from metadata whether a
given plugin is executable on the current platform?
If we use 'distutils.util.get_platform()' and do simple string comparison,
I believe this will result in both false positives and false negatives, due
to e.g. the absence of processor info for Windows platforms, and the
presence of processor info or OS version info for other platforms. For
example, a 'linux-i386' module might work with a 'linux-i686' platform, yet
not be accepted by a simple string comparison.
Of course, if that metadata is encoded only in the plugin filename, then
it's relatively simple to create copies with different filenames, one per
applicable platform string. Or, perhaps there could be some type of
configuration file that simply lists what platform strings (besides the one
the machine itself generates) are acceptable on the machine.
But, false positives seem harder to fix. For example, "win32" is used for
both 32-bit and 64-bit Windows targets. I'm unsure whether any of the
other targets have similar issues.
Does anybody have any ideas?