Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #210 from astropy/issue-209
Browse files Browse the repository at this point in the history
Provides a fix for #209
  • Loading branch information
embray committed Dec 21, 2015
1 parent edf9f47 commit ef0c823
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
astropy-helpers Changelog
=========================

1.1.1 (unreleased)
------------------

- Fixed crash in build with ``AttributeError: cython_create_listing``
with older versions of setuptools. [#209]


1.1 (2015-12-10)
----------------

Expand Down
20 changes: 16 additions & 4 deletions astropy_helpers/commands/build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,21 @@ def merge_options(attr):
[opt for opt in cls._boolean_options
if opt not in base_cls.boolean_options])

members = {
members = dict(cls.__dict__)
members.update({
'user_options': merge_options('user_options'),
'help_options': merge_options('help_options'),
'boolean_options': boolean_options,
'uses_cython': uses_cython,
}
})

return type(cls.__name__, (cls, base_cls,), members)
# Update the base class for the original build_ext command
build_ext.__bases__ = (base_cls, object)

# Create a new class for the existing class, but now with the
# appropriate base class depending on whether or not to use Cython.
# Ensure that object is one of the bases to make a new-style class.
return type(cls.__name__, (build_ext,), members)

def __new__(cls, *args, **kwargs):
# By the time the command is actually instantialized, the
Expand All @@ -226,9 +233,14 @@ def __new__(cls, *args, **kwargs):
# instance of a build_ext command that uses that base class (right
# now the options being Cython.Distutils.build_ext, or the stock
# setuptools build_ext)
return super(build_ext, cls._final_class).__new__(
new_cls = super(build_ext, cls._final_class).__new__(
cls._final_class)

# Since the new cls is not a subclass of the original cls, we must
# manually call its __init__
new_cls.__init__(*args, **kwargs)
return new_cls

def finalize_options(self):
# Add a copy of the _compiler.so module as well, but only if there
# are in fact C modules to compile (otherwise there's no reason to
Expand Down

0 comments on commit ef0c823

Please sign in to comment.