From 7540da8c329ec30e6ea3e15f725551d1c90913d7 Mon Sep 17 00:00:00 2001 From: Thomas Ferreira de Lima Date: Mon, 16 Jul 2018 01:12:11 -0400 Subject: [PATCH 1/8] changing to setuptools and fixing macOS linking --- .gitignore | 5 +++++ setup.py | 66 +++++++++++++++++++++++++++++------------------------- 2 files changed, 41 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index 7ca9f7416..1399b8a14 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,8 @@ src/plugins/* # QTCreator files src/klayout.pro.user + +# python setuptools eggs +*.egg-info/ +build/ +dist/ diff --git a/setup.py b/setup.py index 4b917b17d..342c935ce 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ Build requirements are: The main challenge is to map KLayout's shared object architecture. The structure consists of the Python extension libraries and a bunch -of libraries providing the actual implementation part. +of libraries providing the actual implementation part. The Python extension libraries reference the implementation libraries. The extension libraries are prefixed with an underscore. @@ -39,22 +39,22 @@ For example: tl (Python) -> _tl, _gsi -There is a specific issue with the building of the extension +There is a specific issue with the building of the extension libraries: distutils only allows building of shared objects as extension libraries and does not provide a intrinsic feature -for linking other libraries into the extension library. +for linking other libraries into the extension library. Hence we need to add the dependencies through "extra_objects". -On Linux there is a specific issue: The shared objects produced +On Linux there is a specific issue: The shared objects produced for extension libraries are not matching the Linux name conventions. -So we have to add them as .so link objects including the path. -If we do so, the runtime loading will look them up by their path -and won't find them. So we need to take away the path with +So we have to add them as .so link objects including the path. +If we do so, the runtime loading will look them up by their path +and won't find them. So we need to take away the path with "-Wl,-soname" on Linux (see Config.link_args). """ -from distutils.core import setup, Extension, Distribution +from setuptools import setup, Extension, Distribution import glob import os import platform @@ -124,15 +124,17 @@ class Config(object): elif platform.system() == "Darwin": # For the dependency modules, make sure we produce a dylib. # We can only link against such, but the bundles produced otherwise. - if mod[0:1] == "_": - return [ "-Wl,-dylib" ] + args = [] + if mod[0] == "_": + args += [ "-Wl,-dylib", '-Wl,-install_name,@rpath/%s' % self.libname_of(mod) ] else: - return [] + args += ['-Wl,-rpath,@loader_path/'] + return args else: # this makes the libraries suitable for linking with a path - # i.e. from path_of('_tl'). Without this option, the path # will be included in the reference and at runtime the loaded - # will look for the path-qualified library. But that's the + # will look for the path-qualified library. But that's the # build path and the loader will fail. return ['-Wl,-soname,' + self.libname_of(mod)] @@ -161,7 +163,7 @@ _tl_sources.remove("src/tl/tl/tlHttpStreamNoQt.cc") _tl_sources.remove("src/tl/tl/tlFileSystemWatcher.cc") _tl_sources.remove("src/tl/tl/tlDeferredExecutionQt.cc") -_tl = Extension(config.root + '._tl', +_tl = Extension(config.root + '._tl', define_macros = config.macros() + [ ('MAKE_TL_LIBRARY', 1) ], language = 'c++', libraries = [ 'curl', 'expat' ], @@ -174,7 +176,7 @@ _tl = Extension(config.root + '._tl', _gsi_sources = glob.glob("src/gsi/gsi/*.cc") -_gsi = Extension(config.root + '._gsi', +_gsi = Extension(config.root + '._gsi', define_macros = config.macros() + [ ('MAKE_GSI_LIBRARY', 1) ], include_dirs = [ 'src/tl/tl' ], extra_objects = [ config.path_of('_tl') ], @@ -189,7 +191,7 @@ _gsi = Extension(config.root + '._gsi', _pya_sources = glob.glob("src/pya/pya/*.cc") -_pya = Extension(config.root + '._pya', +_pya = Extension(config.root + '._pya', define_macros = config.macros() + [ ('MAKE_PYA_LIBRARY', 1) ], include_dirs = [ 'src/tl/tl', 'src/gsi/gsi' ], extra_objects = [ config.path_of('_tl'), config.path_of('_gsi') ], @@ -207,7 +209,7 @@ _db_sources = glob.glob("src/db/db/*.cc") # Not a real source: _db_sources.remove("src/db/db/fonts.cc") -_db = Extension(config.root + '._db', +_db = Extension(config.root + '._db', define_macros = config.macros() + [ ('MAKE_DB_LIBRARY', 1) ], include_dirs = [ 'src/tl/tl', 'src/gsi/gsi', 'src/db/db' ], extra_objects = [ config.path_of('_tl'), config.path_of('_gsi') ], @@ -222,7 +224,7 @@ _db = Extension(config.root + '._db', _rdb_sources = glob.glob("src/rdb/rdb/*.cc") -_rdb = Extension(config.root + '._rdb', +_rdb = Extension(config.root + '._rdb', define_macros = config.macros() + [ ('MAKE_RDB_LIBRARY', 1) ], include_dirs = [ 'src/db/db', 'src/tl/tl', 'src/gsi/gsi' ], extra_objects = [ config.path_of('_tl'), config.path_of('_gsi'), config.path_of('_db') ], @@ -252,19 +254,20 @@ for pi in glob.glob("src/plugins/*/db_plugin") + glob.glob("src/plugins/*/*/db_p extra_link_args = config.link_args(mod_name), extra_compile_args = config.compile_args(mod_name), sources = pi_sources) - + db_plugins.append(pi_ext) - + # ------------------------------------------------------------------ # tl extension library tl_sources = glob.glob("src/pymod/tl/*.cc") -tl = Extension(config.root + '.tl', +tl = Extension(config.root + '.tl', define_macros = config.macros(), include_dirs = [ 'src/tl/tl', 'src/gsi/gsi', 'src/pya/pya' ], extra_objects = [ config.path_of('_tl'), config.path_of('_gsi'), config.path_of('_pya') ], runtime_library_dirs = config.rpath(), + extra_link_args = config.link_args('tl'), sources = tl_sources) # ------------------------------------------------------------------ @@ -272,11 +275,12 @@ tl = Extension(config.root + '.tl', db_sources = glob.glob("src/pymod/db/*.cc") -db = Extension(config.root + '.db', +db = Extension(config.root + '.db', define_macros = config.macros(), include_dirs = [ 'src/db/db', 'src/tl/tl', 'src/gsi/gsi', 'src/pya/pya' ], extra_objects = [ config.path_of('_db'), config.path_of('_tl'), config.path_of('_gsi'), config.path_of('_pya') ], runtime_library_dirs = config.rpath(), + extra_link_args = config.link_args('db'), sources = db_sources) # ------------------------------------------------------------------ @@ -284,22 +288,24 @@ db = Extension(config.root + '.db', rdb_sources = glob.glob("src/pymod/rdb/*.cc") -rdb = Extension(config.root + '.rdb', +rdb = Extension(config.root + '.rdb', define_macros = config.macros(), include_dirs = [ 'src/rdb/rdb', 'src/db/db', 'src/tl/tl', 'src/gsi/gsi', 'src/pya/pya' ], extra_objects = [ config.path_of('_rdb'), config.path_of('_gsi'), config.path_of('_pya') ], runtime_library_dirs = config.rpath(), + extra_link_args = config.link_args('rdb'), sources = rdb_sources) # ------------------------------------------------------------------ # Core setup function -setup(name = config.root, - version = config.version(), - description = 'KLayout standalone Python package', - author = 'Matthias Koefferlein', - author_email = 'matthias@klayout.de', - packages = [ config.root ], - package_dir = { config.root: 'src/pymod/distutils_src' }, - ext_modules = [ _tl, _gsi, _pya, _db, _rdb ] + db_plugins + [ tl, db, rdb ]) +if __name__ == '__main__': + setup(name = config.root, + version = config.version(), + description = 'KLayout standalone Python package', + author = 'Matthias Koefferlein', + author_email = 'matthias@klayout.de', + packages = [ config.root ], + package_dir = { config.root: 'src/pymod/distutils_src' }, + ext_modules = [ _tl, _gsi, _pya, _db, _rdb ] + db_plugins + [ tl, db, rdb ]) From e1dcaf469ef260a802585a0acf7b447a0ecbc0d8 Mon Sep 17 00:00:00 2001 From: Thomas Ferreira de Lima Date: Mon, 16 Jul 2018 01:16:36 -0400 Subject: [PATCH 2/8] converting to 4-spaces, PEP8 format --- setup.py | 333 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 170 insertions(+), 163 deletions(-) diff --git a/setup.py b/setup.py index 342c935ce..41b0cc158 100644 --- a/setup.py +++ b/setup.py @@ -4,21 +4,21 @@ KLayout standalone Python module setup script - Copyright (C) 2006-2018 Matthias Koefferlein + Copyright (C) 2006-2018 Matthias Koefferlein - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA This script provides distutils-based deployment for KLayout's @@ -37,7 +37,7 @@ The extension libraries are prefixed with an underscore. For example: - tl (Python) -> _tl, _gsi + tl (Python) -> _tl, _gsi There is a specific issue with the building of the extension libraries: distutils only allows building of shared objects @@ -62,93 +62,94 @@ import sysconfig # ---------------------------------------------------------------------------------------- + class Config(object): - """ - Provides some configuration-specific methods - """ + """ + Provides some configuration-specific methods + """ - def __init__(self): + def __init__(self): - # TODO: is this really how we get the build paths? + # TODO: is this really how we get the build paths? - build_cmd = Distribution().get_command_obj('build') - build_cmd.finalize_options() - self.build_platlib = build_cmd.build_platlib + build_cmd = Distribution().get_command_obj('build') + build_cmd.finalize_options() + self.build_platlib = build_cmd.build_platlib - install_cmd = Distribution().get_command_obj('install') - install_cmd.finalize_options() - self.install_platlib = install_cmd.install_platlib + install_cmd = Distribution().get_command_obj('install') + install_cmd.finalize_options() + self.install_platlib = install_cmd.install_platlib - self.ext_suffix = sysconfig.get_config_var("EXT_SUFFIX") - self.root = "klayout" + self.ext_suffix = sysconfig.get_config_var("EXT_SUFFIX") + self.root = "klayout" - def libname_of(self, mod): - """ - Returns the library name for a given module - The library name is usually decorated (i.e. "tl" -> "tl.cpython-35m-x86_64-linux-gnu.so"). - """ - return mod + self.ext_suffix + def libname_of(self, mod): + """ + Returns the library name for a given module + The library name is usually decorated (i.e. "tl" -> "tl.cpython-35m-x86_64-linux-gnu.so"). + """ + return mod + self.ext_suffix - def path_of(self, mod): - """ - Returns the build path of the library for a given module - """ - return os.path.join(self.build_platlib, self.root, self.libname_of(mod)) + def path_of(self, mod): + """ + Returns the build path of the library for a given module + """ + return os.path.join(self.build_platlib, self.root, self.libname_of(mod)) - def rpath(self): - """ - Returns the runtime_library_dir to use when linking the modules - This path will ensure the auxiliary modules are found at runtime. - """ - return [ os.path.join(self.install_platlib, self.root) ] + def rpath(self): + """ + Returns the runtime_library_dir to use when linking the modules + This path will ensure the auxiliary modules are found at runtime. + """ + return [os.path.join(self.install_platlib, self.root)] - def compile_args(self, mod): - """ - Gets additional compiler arguments - """ - if platform.system() == "Windows": - return [ ] - elif platform.system() == "Darwin": - return [ ] - else: - # Avoids many "type-punned pointer" warnings - return [ "-Wno-strict-aliasing" ] + def compile_args(self, mod): + """ + Gets additional compiler arguments + """ + if platform.system() == "Windows": + return [] + elif platform.system() == "Darwin": + return [] + else: + # Avoids many "type-punned pointer" warnings + return ["-Wno-strict-aliasing"] - def link_args(self, mod): - """ - Gets additional linker arguments - """ - if platform.system() == "Windows": - return [ ] - elif platform.system() == "Darwin": - # For the dependency modules, make sure we produce a dylib. - # We can only link against such, but the bundles produced otherwise. - args = [] - if mod[0] == "_": - args += [ "-Wl,-dylib", '-Wl,-install_name,@rpath/%s' % self.libname_of(mod) ] - else: - args += ['-Wl,-rpath,@loader_path/'] - return args - else: - # this makes the libraries suitable for linking with a path - - # i.e. from path_of('_tl'). Without this option, the path - # will be included in the reference and at runtime the loaded - # will look for the path-qualified library. But that's the - # build path and the loader will fail. - return ['-Wl,-soname,' + self.libname_of(mod)] + def link_args(self, mod): + """ + Gets additional linker arguments + """ + if platform.system() == "Windows": + return [] + elif platform.system() == "Darwin": + # For the dependency modules, make sure we produce a dylib. + # We can only link against such, but the bundles produced otherwise. + args = [] + if mod[0] == "_": + args += ["-Wl,-dylib", '-Wl,-install_name,@rpath/%s' % self.libname_of(mod)] + else: + args += ['-Wl,-rpath,@loader_path/'] + return args + else: + # this makes the libraries suitable for linking with a path - + # i.e. from path_of('_tl'). Without this option, the path + # will be included in the reference and at runtime the loaded + # will look for the path-qualified library. But that's the + # build path and the loader will fail. + return ['-Wl,-soname,' + self.libname_of(mod)] - def macros(self): - """ - Returns the macros to use for building - """ - return [ ('HAVE_CURL', 1), ('HAVE_EXPAT', 1) ] + def macros(self): + """ + Returns the macros to use for building + """ + return [('HAVE_CURL', 1), ('HAVE_EXPAT', 1)] - def version(self): - """ - Gets the version string - """ - return "0.26" + def version(self): + """ + Gets the version string + """ + return "0.26" config = Config() @@ -164,12 +165,12 @@ _tl_sources.remove("src/tl/tl/tlFileSystemWatcher.cc") _tl_sources.remove("src/tl/tl/tlDeferredExecutionQt.cc") _tl = Extension(config.root + '._tl', - define_macros = config.macros() + [ ('MAKE_TL_LIBRARY', 1) ], - language = 'c++', - libraries = [ 'curl', 'expat' ], - extra_link_args = config.link_args('_tl'), - extra_compile_args = config.compile_args('_tl'), - sources = _tl_sources) + define_macros=config.macros() + [('MAKE_TL_LIBRARY', 1)], + language='c++', + libraries=['curl', 'expat'], + extra_link_args=config.link_args('_tl'), + extra_compile_args=config.compile_args('_tl'), + sources=_tl_sources) # ------------------------------------------------------------------ # _gsi dependency library @@ -177,14 +178,14 @@ _tl = Extension(config.root + '._tl', _gsi_sources = glob.glob("src/gsi/gsi/*.cc") _gsi = Extension(config.root + '._gsi', - define_macros = config.macros() + [ ('MAKE_GSI_LIBRARY', 1) ], - include_dirs = [ 'src/tl/tl' ], - extra_objects = [ config.path_of('_tl') ], - runtime_library_dirs = config.rpath(), - language = 'c++', - extra_link_args = config.link_args('_gsi'), - extra_compile_args = config.compile_args('_gsi'), - sources = _gsi_sources) + define_macros=config.macros() + [('MAKE_GSI_LIBRARY', 1)], + include_dirs=['src/tl/tl'], + extra_objects=[config.path_of('_tl')], + runtime_library_dirs=config.rpath(), + language='c++', + extra_link_args=config.link_args('_gsi'), + extra_compile_args=config.compile_args('_gsi'), + sources=_gsi_sources) # ------------------------------------------------------------------ # _pya dependency library @@ -192,14 +193,14 @@ _gsi = Extension(config.root + '._gsi', _pya_sources = glob.glob("src/pya/pya/*.cc") _pya = Extension(config.root + '._pya', - define_macros = config.macros() + [ ('MAKE_PYA_LIBRARY', 1) ], - include_dirs = [ 'src/tl/tl', 'src/gsi/gsi' ], - extra_objects = [ config.path_of('_tl'), config.path_of('_gsi') ], - runtime_library_dirs = config.rpath(), - language = 'c++', - extra_link_args = config.link_args('_pya'), - extra_compile_args = config.compile_args('_pya'), - sources = _pya_sources) + define_macros=config.macros() + [('MAKE_PYA_LIBRARY', 1)], + include_dirs=['src/tl/tl', 'src/gsi/gsi'], + extra_objects=[config.path_of('_tl'), config.path_of('_gsi')], + runtime_library_dirs=config.rpath(), + language='c++', + extra_link_args=config.link_args('_pya'), + extra_compile_args=config.compile_args('_pya'), + sources=_pya_sources) # ------------------------------------------------------------------ # _db dependency library @@ -210,14 +211,14 @@ _db_sources = glob.glob("src/db/db/*.cc") _db_sources.remove("src/db/db/fonts.cc") _db = Extension(config.root + '._db', - define_macros = config.macros() + [ ('MAKE_DB_LIBRARY', 1) ], - include_dirs = [ 'src/tl/tl', 'src/gsi/gsi', 'src/db/db' ], - extra_objects = [ config.path_of('_tl'), config.path_of('_gsi') ], - runtime_library_dirs = config.rpath(), - language = 'c++', - extra_link_args = config.link_args('_db'), - extra_compile_args = config.compile_args('_db'), - sources = _db_sources) + define_macros=config.macros() + [('MAKE_DB_LIBRARY', 1)], + include_dirs=['src/tl/tl', 'src/gsi/gsi', 'src/db/db'], + extra_objects=[config.path_of('_tl'), config.path_of('_gsi')], + runtime_library_dirs=config.rpath(), + language='c++', + extra_link_args=config.link_args('_db'), + extra_compile_args=config.compile_args('_db'), + sources=_db_sources) # ------------------------------------------------------------------ # _rdb dependency library @@ -225,14 +226,15 @@ _db = Extension(config.root + '._db', _rdb_sources = glob.glob("src/rdb/rdb/*.cc") _rdb = Extension(config.root + '._rdb', - define_macros = config.macros() + [ ('MAKE_RDB_LIBRARY', 1) ], - include_dirs = [ 'src/db/db', 'src/tl/tl', 'src/gsi/gsi' ], - extra_objects = [ config.path_of('_tl'), config.path_of('_gsi'), config.path_of('_db') ], - runtime_library_dirs = config.rpath(), - language = 'c++', - extra_link_args = config.link_args('_rdb'), - extra_compile_args = config.compile_args('_rdb'), - sources = _rdb_sources) + define_macros=config.macros() + [('MAKE_RDB_LIBRARY', 1)], + include_dirs=['src/db/db', 'src/tl/tl', 'src/gsi/gsi'], + extra_objects=[config.path_of('_tl'), config.path_of( + '_gsi'), config.path_of('_db')], + runtime_library_dirs=config.rpath(), + language='c++', + extra_link_args=config.link_args('_rdb'), + extra_compile_args=config.compile_args('_rdb'), + sources=_rdb_sources) # ------------------------------------------------------------------ # dependency libraries from db_plugins @@ -241,21 +243,23 @@ db_plugins = [] for pi in glob.glob("src/plugins/*/db_plugin") + glob.glob("src/plugins/*/*/db_plugin"): - mod_name = "_" + os.path.split(os.path.split(pi)[-2])[-1] + "_dbpi" + mod_name = "_" + os.path.split(os.path.split(pi)[-2])[-1] + "_dbpi" - pi_sources = glob.glob(pi + "/*.cc") + pi_sources = glob.glob(pi + "/*.cc") - pi_ext = Extension(config.root + '.db_plugins.' + mod_name, - define_macros = config.macros() + [ ('MAKE_DB_PLUGIN_LIBRARY', 1) ], - include_dirs = [ 'src/plugins/common', 'src/db/db', 'src/tl/tl', 'src/gsi/gsi' ], - extra_objects = [ config.path_of('_tl'), config.path_of('_gsi'), config.path_of('_db') ], - runtime_library_dirs = config.rpath(), - language = 'c++', - extra_link_args = config.link_args(mod_name), - extra_compile_args = config.compile_args(mod_name), - sources = pi_sources) + pi_ext = Extension(config.root + '.db_plugins.' + mod_name, + define_macros=config.macros() + [('MAKE_DB_PLUGIN_LIBRARY', 1)], + include_dirs=['src/plugins/common', + 'src/db/db', 'src/tl/tl', 'src/gsi/gsi'], + extra_objects=[config.path_of('_tl'), config.path_of( + '_gsi'), config.path_of('_db')], + runtime_library_dirs=config.rpath(), + language='c++', + extra_link_args=config.link_args(mod_name), + extra_compile_args=config.compile_args(mod_name), + sources=pi_sources) - db_plugins.append(pi_ext) + db_plugins.append(pi_ext) # ------------------------------------------------------------------ # tl extension library @@ -263,12 +267,13 @@ for pi in glob.glob("src/plugins/*/db_plugin") + glob.glob("src/plugins/*/*/db_p tl_sources = glob.glob("src/pymod/tl/*.cc") tl = Extension(config.root + '.tl', - define_macros = config.macros(), - include_dirs = [ 'src/tl/tl', 'src/gsi/gsi', 'src/pya/pya' ], - extra_objects = [ config.path_of('_tl'), config.path_of('_gsi'), config.path_of('_pya') ], - runtime_library_dirs = config.rpath(), - extra_link_args = config.link_args('tl'), - sources = tl_sources) + define_macros=config.macros(), + include_dirs=['src/tl/tl', 'src/gsi/gsi', 'src/pya/pya'], + extra_objects=[config.path_of('_tl'), config.path_of( + '_gsi'), config.path_of('_pya')], + runtime_library_dirs=config.rpath(), + extra_link_args=config.link_args('tl'), + sources=tl_sources) # ------------------------------------------------------------------ # db extension library @@ -276,12 +281,13 @@ tl = Extension(config.root + '.tl', db_sources = glob.glob("src/pymod/db/*.cc") db = Extension(config.root + '.db', - define_macros = config.macros(), - include_dirs = [ 'src/db/db', 'src/tl/tl', 'src/gsi/gsi', 'src/pya/pya' ], - extra_objects = [ config.path_of('_db'), config.path_of('_tl'), config.path_of('_gsi'), config.path_of('_pya') ], - runtime_library_dirs = config.rpath(), - extra_link_args = config.link_args('db'), - sources = db_sources) + define_macros=config.macros(), + include_dirs=['src/db/db', 'src/tl/tl', 'src/gsi/gsi', 'src/pya/pya'], + extra_objects=[config.path_of('_db'), config.path_of( + '_tl'), config.path_of('_gsi'), config.path_of('_pya')], + runtime_library_dirs=config.rpath(), + extra_link_args=config.link_args('db'), + sources=db_sources) # ------------------------------------------------------------------ # rdb extension library @@ -289,23 +295,24 @@ db = Extension(config.root + '.db', rdb_sources = glob.glob("src/pymod/rdb/*.cc") rdb = Extension(config.root + '.rdb', - define_macros = config.macros(), - include_dirs = [ 'src/rdb/rdb', 'src/db/db', 'src/tl/tl', 'src/gsi/gsi', 'src/pya/pya' ], - extra_objects = [ config.path_of('_rdb'), config.path_of('_gsi'), config.path_of('_pya') ], - runtime_library_dirs = config.rpath(), - extra_link_args = config.link_args('rdb'), - sources = rdb_sources) + define_macros=config.macros(), + include_dirs=['src/rdb/rdb', 'src/db/db', + 'src/tl/tl', 'src/gsi/gsi', 'src/pya/pya'], + extra_objects=[config.path_of('_rdb'), config.path_of( + '_gsi'), config.path_of('_pya')], + runtime_library_dirs=config.rpath(), + extra_link_args=config.link_args('rdb'), + sources=rdb_sources) # ------------------------------------------------------------------ # Core setup function if __name__ == '__main__': - setup(name = config.root, - version = config.version(), - description = 'KLayout standalone Python package', - author = 'Matthias Koefferlein', - author_email = 'matthias@klayout.de', - packages = [ config.root ], - package_dir = { config.root: 'src/pymod/distutils_src' }, - ext_modules = [ _tl, _gsi, _pya, _db, _rdb ] + db_plugins + [ tl, db, rdb ]) - + setup(name=config.root, + version=config.version(), + description='KLayout standalone Python package', + author='Matthias Koefferlein', + author_email='matthias@klayout.de', + packages=[config.root], + package_dir={config.root: 'src/pymod/distutils_src'}, + ext_modules=[_tl, _gsi, _pya, _db, _rdb] + db_plugins + [tl, db, rdb]) From 8330415b2983906eea4ea4664965484ff28b54da Mon Sep 17 00:00:00 2001 From: Thomas Ferreira de Lima Date: Mon, 16 Jul 2018 01:52:51 -0400 Subject: [PATCH 3/8] adding rpath to all libraries --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 41b0cc158..abdb0dad9 100644 --- a/setup.py +++ b/setup.py @@ -128,8 +128,7 @@ class Config(object): args = [] if mod[0] == "_": args += ["-Wl,-dylib", '-Wl,-install_name,@rpath/%s' % self.libname_of(mod)] - else: - args += ['-Wl,-rpath,@loader_path/'] + args += ['-Wl,-rpath,@loader_path/'] return args else: # this makes the libraries suitable for linking with a path - From c269f39ba09083e19df00be8b2d91e0baf4e9861 Mon Sep 17 00:00:00 2001 From: Thomas Ferreira de Lima Date: Mon, 16 Jul 2018 01:53:10 -0400 Subject: [PATCH 4/8] setting up travis compilation --- .travis.yml | 18 ++++++++++++++++++ Brewfile | 4 ++++ 2 files changed, 22 insertions(+) create mode 100644 .travis.yml create mode 100644 Brewfile diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..3690bab81 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +matrix: + include: + - os: osx + osx_image: xcode9.3beta + env: + - MATRIX_EVAL="" + +before_install: + - eval "${MATRIX_EVAL}" + - brew update + - brew bundle + +install: + - python3 setup.py install +script: + - python3 -c 'import klayout.db as db; dir(db)' + - python3 -c 'import klayout.rdb as rdb; dir(rdb)' + - python3 -c 'import klayout.tl as tl; dir(tl)' diff --git a/Brewfile b/Brewfile new file mode 100644 index 000000000..c4345be0c --- /dev/null +++ b/Brewfile @@ -0,0 +1,4 @@ +tap "homebrew/core" +brew "python3" +brew "curl" +brew "expat" From 2a2660290bad8788d5dbb19eb39438a01b0a5bbe Mon Sep 17 00:00:00 2001 From: Thomas Ferreira de Lima Date: Mon, 16 Jul 2018 02:23:36 -0400 Subject: [PATCH 5/8] more travis tests --- .travis.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3690bab81..2aa8c9fce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,11 @@ before_install: install: - python3 setup.py install script: - - python3 -c 'import klayout.db as db; dir(db)' - - python3 -c 'import klayout.rdb as rdb; dir(rdb)' - - python3 -c 'import klayout.tl as tl; dir(tl)' + - python3 -c 'import klayout.db as db; print(dir(db))' + - python3 -c 'import klayout.rdb as rdb; print(dir(rdb))' + - python3 -c 'import klayout.tl as tl; print(dir(tl))' + - python3 -c 'import klayout._db as db; print(dir(db))' + - python3 -c 'import klayout._rdb as rdb; print(dir(rdb))' + - python3 -c 'import klayout._tl as tl; print(dir(tl))' + - python3 -c 'import klayout._gsi as gsi; print(dir(gsi))' + - python3 -c 'import klayout._pya as pya; print(dir(pya))' From bd046405e3bc80460d7168dc7fa4fe5eafc86fbd Mon Sep 17 00:00:00 2001 From: Thomas Ferreira de Lima Date: Mon, 16 Jul 2018 09:35:25 -0400 Subject: [PATCH 6/8] only importing tl, db and rdb for testing --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2aa8c9fce..1c828bcbc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ before_install: - eval "${MATRIX_EVAL}" - brew update - brew bundle + - env install: - python3 setup.py install @@ -16,8 +17,3 @@ script: - python3 -c 'import klayout.db as db; print(dir(db))' - python3 -c 'import klayout.rdb as rdb; print(dir(rdb))' - python3 -c 'import klayout.tl as tl; print(dir(tl))' - - python3 -c 'import klayout._db as db; print(dir(db))' - - python3 -c 'import klayout._rdb as rdb; print(dir(rdb))' - - python3 -c 'import klayout._tl as tl; print(dir(tl))' - - python3 -c 'import klayout._gsi as gsi; print(dir(gsi))' - - python3 -c 'import klayout._pya as pya; print(dir(pya))' From eb9d53e9900a77b1b2d1bdefdc325534263aba1a Mon Sep 17 00:00:00 2001 From: Thomas Ferreira de Lima Date: Mon, 16 Jul 2018 10:40:16 -0400 Subject: [PATCH 7/8] trying without brew curl and expat --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1c828bcbc..1dfa6669f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,6 @@ matrix: before_install: - eval "${MATRIX_EVAL}" - - brew update - - brew bundle - env install: From 11ff91b00b14e66cf72cc534fc3a872289fd0a18 Mon Sep 17 00:00:00 2001 From: Thomas Ferreira de Lima Date: Mon, 16 Jul 2018 10:45:03 -0400 Subject: [PATCH 8/8] trying without brew curl and expat (bis) --- .travis.yml | 2 ++ Brewfile | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1dfa6669f..1c828bcbc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,8 @@ matrix: before_install: - eval "${MATRIX_EVAL}" + - brew update + - brew bundle - env install: diff --git a/Brewfile b/Brewfile index c4345be0c..f84c801df 100644 --- a/Brewfile +++ b/Brewfile @@ -1,4 +1,2 @@ tap "homebrew/core" brew "python3" -brew "curl" -brew "expat"