Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge of regebro-python3 branch, adding Python 3.1 compatibility\!
- Loading branch information
Showing
23 changed files
with
502 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import sys | ||
from distutils.errors import (CCompilerError, DistutilsExecError, | ||
DistutilsPlatformError) | ||
try: | ||
from setuptools.command.build_ext import build_ext | ||
except ImportError: | ||
from distutils.command.build_ext import build_ext | ||
|
||
|
||
class optional_build_ext(build_ext): | ||
"""This class subclasses build_ext and allows | ||
the building of C extensions to fail. | ||
""" | ||
def run(self): | ||
try: | ||
build_ext.run(self) | ||
|
||
except DistutilsPlatformError, e: | ||
self._unavailable(e) | ||
|
||
def build_extension(self, ext): | ||
try: | ||
build_ext.build_extension(self, ext) | ||
|
||
except (CCompilerError, DistutilsExecError), e: | ||
self._unavailable(e) | ||
|
||
def _unavailable(self, e): | ||
print >> sys.stderr, '*' * 80 | ||
print >> sys.stderr, """WARNING: | ||
An optional code optimization (C extension) could not be compiled. | ||
Optimizations for this package will not be available!""" | ||
print >> sys.stderr | ||
print >> sys.stderr, e | ||
print >> sys.stderr, '*' * 80 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import os | ||
import sys | ||
from distutils.errors import (CCompilerError, DistutilsExecError, | ||
DistutilsPlatformError) | ||
try: | ||
from setuptools.command.build_ext import build_ext | ||
from pkg_resources import (normalize_path, working_set, | ||
add_activation_listener, require) | ||
except ImportError: | ||
from distutils.command.build_ext import build_ext | ||
|
||
|
||
class optional_build_ext(build_ext): | ||
"""This class subclasses build_ext and allows | ||
the building of C extensions to fail. | ||
""" | ||
def run(self): | ||
try: | ||
build_ext.run(self) | ||
|
||
except DistutilsPlatformError as e: | ||
self._unavailable(e) | ||
|
||
def build_extension(self, ext): | ||
try: | ||
build_ext.build_extension(self, ext) | ||
|
||
except (CCompilerError, DistutilsExecError) as e: | ||
self._unavailable(e) | ||
|
||
def _unavailable(self, e): | ||
print('*' * 80, file=sys.stderr) | ||
print("""WARNING: | ||
An optional code optimization (C extension) could not be compiled. | ||
Optimizations for this package will not be available!""", file=sys.stderr) | ||
print(file=sys.stderr) | ||
print(e, file=sys.stderr) | ||
print('*' * 80, file=sys.stderr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.