This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/python/swig/setup.py.in

170 lines
5.5 KiB
Python
Raw Normal View History

2017-05-14 11:27:44 +01:00
#!/usr/bin/env python
# coding: utf-8
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
from setuptools import setup
2017-06-15 22:40:55 +01:00
from setuptools.extension import Extension
2017-05-14 11:27:44 +01:00
from codecs import open
from os import path, makedirs, walk
from shutil import copytree, rmtree, copy2, move
from glob import glob
from pathlib import Path
import platform
import os.path
# the name of the package
2017-05-14 11:36:09 +01:00
name = 'YAP4PY'
2017-05-14 11:27:44 +01:00
2017-06-12 18:00:47 +01:00
# -----------------------------------------------------------------------------
2017-05-14 11:27:44 +01:00
# Minimal Python version sanity check
2017-06-12 18:00:47 +01:00
# -----------------------------------------------------------------------------
2017-05-14 11:27:44 +01:00
import sys
v = sys.version_info
2017-06-12 18:00:47 +01:00
if v[:2] < (2, 7) or (v[0] >= 3 and v[:2] < (3, 3)):
2017-05-14 11:27:44 +01:00
error = "ERROR: %s requires Python version 2.7 or 3.3 or above." % name
print(error, file=sys.stderr)
sys.exit(1)
PY3 = (sys.version_info[0] >= 3)
2017-06-12 18:00:47 +01:00
# -----------------------------------------------------------------------------
2017-05-14 11:27:44 +01:00
# get on with it
2017-06-12 18:00:47 +01:00
# -----------------------------------------------------------------------------
2017-05-14 11:36:09 +01:00
from codecs import open
from os import path, makedirs, walk
from shutil import copytree, rmtree, copy2, move
2017-05-14 11:27:44 +01:00
from glob import glob
2017-05-14 11:36:09 +01:00
from pathlib import Path
import platform
import os.path
2017-05-14 11:27:44 +01:00
import os
import shutil
from distutils.core import setup
pjoin = os.path.join
here = os.path.abspath(os.path.dirname(__file__))
pkg_root = pjoin(here, name)
my_extra_link_args = []
2017-06-16 11:53:46 +01:00
if platform.system() == 'Windows':
local_libs = []
win_libs = ['wsock32','ws2_32']
my_extra_link_args = ['-Wl,-export-all-symbols']
else:
# if platform.system() == 'Darwin':
2017-06-12 18:00:47 +01:00
my_extra_link_args = ['-Wl,-rpath', '-Wl,${_ABS_PYTHON_MODULE_PATH}']
2017-06-15 22:40:55 +01:00
win_libs = []
local_libs = ['YAP++','Py4YAP']
2017-06-12 18:00:47 +01:00
# or dll in glob('yap/dlls/*'):
2017-05-14 11:27:44 +01:00
# move( dll ,'lib' )
2017-06-12 18:00:47 +01:00
cplus = ['']
2017-06-15 22:40:55 +01:00
bpy2yap = []
2017-06-16 11:53:46 +01:00
native_sources = ['yap_wrap.cpp']
2017-05-14 11:27:44 +01:00
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
2017-06-15 22:40:55 +01:00
2017-06-12 18:00:47 +01:00
extensions = [Extension('_yap', native_sources,
define_macros=[('MAJOR_VERSION', '1'),
2017-05-14 11:27:44 +01:00
('MINOR_VERSION', '0'),
('_YAP_NOT_INSTALLED_', '1'),
2017-06-15 22:40:55 +01:00
('YAP_PYTHON', '1'),
2017-06-14 12:34:12 +01:00
('_GNU_SOURCE', '1')],
2017-06-12 18:00:47 +01:00
runtime_library_dirs=['yap4py', '${libdir}', '${bindir}'],
2017-06-13 13:34:17 +01:00
swig_opts=['-modern', '-c++', '-py3',
'-DX_API', '-I${CMAKE_SOURCE_DIR}/CXX', '-I${CMAKE_SOURCE_DIR}/include',
2017-06-12 18:00:47 +01:00
'-I${CMAKE_SOURCE_DIR}/H', '-I${CMAKE_SOURCE_DIR}/H/generated',
'-I${CMAKE_SOURCE_DIR}/os', '-I${CMAKE_SOURCE_DIR}/OPTYap', '-I../../..'],
2017-09-02 23:47:14 +01:00
library_dirs=['../../..', '../../../CXX', '..', "${dlls}", "${bindir}", 'c:/Anaconda3'],
2017-06-12 18:00:47 +01:00
extra_link_args=my_extra_link_args,
2017-09-02 23:47:14 +01:00
libraries=['Yap','YAPPython','python3','yap']+win_libs+local_libs,
2017-06-12 18:00:47 +01:00
include_dirs=['../../..',
'${GMP_INCLUDE_DIRS}',
'${CMAKE_SOURCE_DIR}/H',
'${CMAKE_SOURCE_DIR}/H/generated',
'${CMAKE_SOURCE_DIR}/OPTYap',
'${CMAKE_SOURCE_DIR}/os',
'${CMAKE_SOURCE_DIR}/include',
'${CMAKE_SOURCE_DIR}/CXX', '.']
)]
2017-05-14 11:27:44 +01:00
packages = ['yap4py']
2017-06-12 18:00:47 +01:00
2017-05-14 11:36:09 +01:00
def visit(d0, pls):
2017-06-12 18:00:47 +01:00
for (r, ds, fs) in walk('.'):
2017-05-14 11:36:09 +01:00
for f in fs:
2017-06-12 18:00:47 +01:00
f0, ext = os.path.splitext(f)
2017-05-14 11:36:09 +01:00
if (ext == 'yap' or ext == 'pl' or ext == 'so' or ext == 'dll' or ext == 'yss'):
pls += [os.path.join(r, f)]
for i in ds:
pls = visit(os.path.join(d0, i), pls)
return pls
2017-05-14 11:27:44 +01:00
2017-06-12 18:00:47 +01:00
2017-05-14 11:27:44 +01:00
package_data = {
2017-09-02 23:47:14 +01:00
'yap4py.prolog': """${PL}""".split(sep=";")
2017-05-14 11:27:44 +01:00
}
2017-06-12 18:00:47 +01:00
version_ns = {'__version__': '6.3.5', 'minor-version': '6', 'minor-version': '3', 'patch': '5'}
2017-05-14 11:27:44 +01:00
setup_args = dict(
2017-06-12 18:00:47 +01:00
name=name,
version=version_ns['__version__'],
scripts=glob(pjoin('scripts', '*')),
packages=packages,
py_modules=['yap'],
package_data=package_data,
include_package_data=True,
2017-09-02 23:47:14 +01:00
requirements=[
'm2w64-gmp',
'm2-msys2-keyring',
'm2-msys2-launcher-git',
'm2-msys2-runtime',
],
2017-06-12 18:00:47 +01:00
description="YAP in Python",
author='YAP Development Team',
author_email='ipython-dev@scipy.org',
url='http://ipython.org',
license='BSD',
ext_modules=extensions,
platforms="Linux, Mac OS X, Windows",
keywords=['Interactive', 'Interpreter', 'Shell', 'Web'],
classifiers=[
2017-05-14 11:27:44 +01:00
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
],
)
if 'develop' in sys.argv or any(a.startswith('bdist') for a in sys.argv):
import setuptools
setuptools_args = {}
install_requires = setuptools_args['install_requires'] = [
]
extras_require = setuptools_args['extras_require'] = {
'test:python_version=="2.7"': ['mock'],
'test': ['nose_warnings_filters', 'nose-timer'],
}
if 'setuptools' in sys.modules:
setup_args.update(setuptools_args)
if __name__ == '__main__':
setup(**setup_args)