Subject: Optional C extensions and setuptools - msg#00051
List: python.distutils.devel
I've just added a small optional C extension to simplejson to speed up
decoding, but I have a feeling that it's going to cause problems for
Windows users.
Right now it's specified as setuptools Feature the same way that
PyProtocols' speedups module is implemented.
Is there something I can do in the setup.py to fail gracefully and
install anyways if it can't compile the extension? In some way that's
compatible with easy_install?
-bob
_______________________________________________
Distutils-SIG maillist - Distutils-SIG@xxxxxxxxxx
http://mail.python.org/mailman/listinfo/distutils-sig
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
Re: pakage index __getitem__
At 07:01 PM 3/17/2007 -0400, Jim Fulton wrote:
>I want to get a list of all of the distributions I can find that
>satisfy a requirement. I've found the following works:
>
> index.obtain(requirement)
> dists = [d for d in index[requirement.project_name] if d in
>requirement]
>
>where index is a setuptools.package_index.PackageIndex.
>
>Is there a better way?
There are other ways, but the above is the simplest and most direct way,
given your use case. Normally, performing a resolve() or require() on a
working set will end up invoking obtain() indirectly, if a requirement
can't otherwise be met -- this allows network access to be lazy, so it's
not done unless it's really needed.
> The obtain call seems to be necessary to
>initialize the index for the given project.
Yes - Environment normally calls 'obtain()' in response to a 'best_match()'
operation, which is in turn called by a WorkingSet's 'resolve()'
method. The idea is that you can subclass Environment (in this case, to
create a PackageIndex) and override 'obtain()' to find packages in
locations that are not part of the working set used to create the Environment.
_______________________________________________
Distutils-SIG maillist - Distutils-SIG@xxxxxxxxxx
http://mail.python.org/mailman/listinfo/distutils-sig
Next Message by Date:
click to view message preview
Re: Optional C extensions and setuptools
On 3/18/07, Bob Ippolito <bob@xxxxxxxxxx> wrote:
> I've just added a small optional C extension to simplejson to speed up
> decoding, but I have a feeling that it's going to cause problems for
> Windows users.
>
> Right now it's specified as setuptools Feature the same way that
> PyProtocols' speedups module is implemented.
>
> Is there something I can do in the setup.py to fail gracefully and
> install anyways if it can't compile the extension? In some way that's
> compatible with easy_install?
Twisted does this: it subclasses build_ext and overrides
build_extensions to check if there's a C compiler before upcalling.
--
Christopher Armstrong
International Man of Twistery
http://radix.twistedmatrix.com/
http://twistedmatrix.com/
http://canonical.com/
_______________________________________________
Distutils-SIG maillist - Distutils-SIG@xxxxxxxxxx
http://mail.python.org/mailman/listinfo/distutils-sig
Previous Message by Thread:
click to view message preview
pakage index __getitem__
I want to get a list of all of the distributions I can find that
satisfy a requirement. I've found the following works:
index.obtain(requirement)
dists = [d for d in index[requirement.project_name] if d in
requirement]
where index is a setuptools.package_index.PackageIndex.
Is there a better way? The obtain call seems to be necessary to
initialize the index for the given project.
Jim
--
Jim Fulton mailto:jim@xxxxxxxx Python Powered!
CTO (540) 361-1714
http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
_______________________________________________
Distutils-SIG maillist - Distutils-SIG@xxxxxxxxxx
http://mail.python.org/mailman/listinfo/distutils-sig
Next Message by Thread:
click to view message preview
Re: Optional C extensions and setuptools
On 3/18/07, Bob Ippolito <bob@xxxxxxxxxx> wrote:
> I've just added a small optional C extension to simplejson to speed up
> decoding, but I have a feeling that it's going to cause problems for
> Windows users.
>
> Right now it's specified as setuptools Feature the same way that
> PyProtocols' speedups module is implemented.
>
> Is there something I can do in the setup.py to fail gracefully and
> install anyways if it can't compile the extension? In some way that's
> compatible with easy_install?
Twisted does this: it subclasses build_ext and overrides
build_extensions to check if there's a C compiler before upcalling.
--
Christopher Armstrong
International Man of Twistery
http://radix.twistedmatrix.com/
http://twistedmatrix.com/
http://canonical.com/
_______________________________________________
Distutils-SIG maillist - Distutils-SIG@xxxxxxxxxx
http://mail.python.org/mailman/listinfo/distutils-sig