summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2015-06-05 08:50:01 +0200
committerAnthon van der Neut <anthon@mnt.org>2015-06-05 08:50:01 +0200
commit97e441d58879670900b13f99d023d49296535126 (patch)
treee3cf21683caea6439fd6e2e40ae7065a396275cb /setup.py
parent202c60292d864540e2eac9015ef2ae937e0e63fa (diff)
downloadruamel.yaml-97e441d58879670900b13f99d023d49296535126.tar.gz
keep start and end sequence when doing 'yaml rt'
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py64
1 files changed, 35 insertions, 29 deletions
diff --git a/setup.py b/setup.py
index d576a66..8d0541c 100644
--- a/setup.py
+++ b/setup.py
@@ -98,6 +98,8 @@ class MyInstallLib(install_lib.install_lib):
def check_extensions():
"""check if the C module can be build by trying to compile a small
program against the libyaml development library"""
+ if sys.platform == "win32":
+ return None
import tempfile
import shutil
@@ -119,37 +121,41 @@ def check_extensions():
}
""")
tmp_dir = tempfile.mkdtemp(prefix='tmp_ruamel_yaml_')
- bin_file_name = os.path.join(tmp_dir, 'test_yaml')
- file_name = bin_file_name + '.c'
- with open(file_name, 'w') as fp:
- fp.write(c_code)
-
- # and try to compile it
- compiler = distutils.ccompiler.new_compiler()
- assert isinstance(compiler, distutils.ccompiler.CCompiler)
- distutils.sysconfig.customize_compiler(compiler)
-
+ ret_val = None
try:
- compiler.link_executable(
- compiler.compile([file_name]),
- bin_file_name,
- libraries=libraries,
- )
- except CompileError:
- print('libyaml compile error')
- ret_val = None
- except LinkError:
- print('libyaml link error')
- ret_val = None
- else:
- ret_val = [
- Extension(
- '_yaml',
- sources=['ext/_yaml.c'],
+ print('tmp_dir', tmp_dir)
+ bin_file_name = os.path.join(tmp_dir, 'test_yaml')
+ file_name = bin_file_name + '.c'
+ with open(file_name, 'w') as fp:
+ fp.write(c_code)
+
+ # and try to compile it
+ compiler = distutils.ccompiler.new_compiler()
+ assert isinstance(compiler, distutils.ccompiler.CCompiler)
+ distutils.sysconfig.customize_compiler(compiler)
+
+ try:
+ compiler.link_executable(
+ compiler.compile([file_name]),
+ bin_file_name,
libraries=libraries,
- ),
- ]
- shutil.rmtree(tmp_dir)
+ )
+ except CompileError:
+ print('libyaml compile error')
+ except LinkError:
+ print('libyaml link error')
+ else:
+ ret_val = [
+ Extension(
+ '_yaml',
+ sources=['ext/_yaml.c'],
+ libraries=libraries,
+ ),
+ ]
+ except:
+ pass
+ finally:
+ shutil.rmtree(tmp_dir)
return ret_val