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

170 lines
5.7 KiB
Python
Raw Normal View History

2017-09-19 13:19:13 +01:00
#!/usr/bin/env python
# coding: utf-8
2017-05-19 10:03:49 +01:00
2017-09-19 13:19:13 +01:00
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
2017-07-03 21:18:01 +01:00
2017-09-19 13:19:13 +01:00
import setuptools
from setuptools import setup
from setuptools.extension import Extension
from codecs import open
from os import path, makedirs, walk
from shutil import copytree, rmtree, copy2, move
2018-03-26 11:03:08 +01:00
import sysconfig
2017-09-19 13:19:13 +01:00
from glob import glob
from pathlib import Path
import platform
import os.path
2017-07-03 21:18:01 +01:00
2017-09-19 13:19:13 +01:00
# the name of the package
name = 'YAP4PY'
2017-05-19 10:03:49 +01:00
2017-09-19 13:19:13 +01:00
# -----------------------------------------------------------------------------
# Minimal Python version sanity check
# -----------------------------------------------------------------------------
import sys
v = sys.version_info
if v[:2] < (2, 7) or (v[0] >= 3 and v[:2] < (3, 3)):
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)
# -----------------------------------------------------------------------------
# get on with it
# -----------------------------------------------------------------------------
2017-05-19 10:03:49 +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
2018-03-26 11:03:08 +01:00
from os.path import dirname, join,abspath
2017-09-19 13:19:13 +01:00
import os
import shutil
from distutils.core import setup
2018-03-26 11:03:08 +01:00
here = abspath(dirname(__file__))
libpydir = abspath(sysconfig.get_path('platlib'))
#libpyauxdir = abspath(os.path.dirname('stdlib'))
#pkg_root = join(here, name)
here = path.abspath(path.dirname(__file__))
2017-09-19 13:19:13 +01:00
sys.path.insert(0, "/home/vsc/github/yap-6.3/packages/python/swig")
2017-05-19 10:03:49 +01:00
2018-03-26 11:03:08 +01:00
python_libdir = path.abspath(path.dirname("/usr/lib/x86_64-linux-gnu/libpython3.6m.so"))
2017-09-19 13:19:13 +01:00
if platform.system() == 'Windows':
local_libs = []
2018-03-26 11:03:08 +01:00
win_libs = ['wsock32','ws2_32']
2017-09-19 13:19:13 +01:00
my_extra_link_args = ['-Wl,-export-all-symbols']
2018-03-26 11:03:08 +01:00
elif platform.system() == 'Darwin':
2018-05-30 13:07:45 +01:00
my_extra_link_args = ['-L','..','-Wl,-rpath,'+abspath(join(sysconfig.get_path('platlib'),'yap4py')),'-Wl,-rpath,/lib','-Wl,-rpath,../yap4py']
2017-09-19 13:19:13 +01:00
win_libs = []
2018-03-26 11:03:08 +01:00
local_libs = ['Py4YAP']
elif platform.system() == 'Linux':
2018-05-30 13:07:45 +01:00
my_extra_link_args = ['-L','..','-Wl,-rpath,'+abspath(join(sysconfig.get_path('platlib'),'yap4py')),'-Wl,-rpath,/lib','-Wl,-rpath,'+join('/lib','..'),'-Wl,-rpath,../yap4py']
2018-03-26 11:03:08 +01:00
win_libs = []
local_libs = ['Py4YAP']
2017-09-19 13:19:13 +01:00
# or dll in glob('yap/dlls/*'):
2017-05-19 10:03:49 +01:00
# move( dll ,'lib' )
2018-03-26 11:03:08 +01:00
native_sources = ["yap4py/yap_wrap.cxx","yap4py/yapi.cpp"]
2017-09-19 13:19:13 +01:00
#gmp_dir = path.abspath(path.dirname("/usr/lib/x86_64-linux-gnu/libgmp.so"))
2017-05-19 10:03:49 +01:00
# Get the long description from the README file
2017-09-19 13:19:13 +01:00
extensions = [Extension('_yap', native_sources,
define_macros=[('MAJOR_VERSION', '1'),
2017-05-19 10:03:49 +01:00
('MINOR_VERSION', '0'),
('_YAP_NOT_INSTALLED_', '1'),
2017-09-19 13:19:13 +01:00
('YAP_PYTHON', '1'),
('_GNU_SOURCE', '1')],
2018-03-26 11:03:08 +01:00
runtime_library_dirs=[
2018-05-30 13:07:45 +01:00
abspath(join(sysconfig.get_path('platlib'),'yap4py')), abspath(sysconfig.get_path('platlib')),'/lib'],
2017-09-19 13:19:13 +01:00
swig_opts=['-modern', '-c++', '-py3',
2018-03-26 11:03:08 +01:00
'-DX_API', '-Iyap4py/include' ],
2018-05-30 13:07:45 +01:00
library_dirs=[".",'../../..','/lib'],
2017-09-19 13:19:13 +01:00
extra_link_args=my_extra_link_args,
libraries=['Yap','gmp']+win_libs+local_libs,
2018-03-26 11:03:08 +01:00
include_dirs=['/home/vsc/github/yap-6.3/H',
'/home/vsc/github/yap-6.3/H/generated',
'/home/vsc/github/yap-6.3/include',
'/home/vsc/github/yap-6.3/OPTYap',
'/home/vsc/github/yap-6.3/os',
'/home/vsc/github/yap-6.3/utf8proc',
'/home/vsc/github/yap-6.3/packages/python',
'../../..',
'/home/vsc/github/yap-6.3/CXX' ]
)]
2017-09-19 13:19:13 +01:00
package_data = {
2018-03-26 11:03:08 +01:00
#'': '*.*'
2017-09-19 13:19:13 +01:00
}
2018-03-26 11:03:08 +01:00
data_files=[]
2017-09-19 13:19:13 +01:00
version_ns = {'__version__': '6.3.5', 'minor-version': '6', 'minor-version': '3', 'patch': '5'}
setup_args = dict(
name=name,
version=version_ns['__version__'],
2018-03-26 11:03:08 +01:00
scripts=glob(join('scripts', '*')),
packages=['yap4py'],
ext_modules=extensions,
sources=['yap4py/yapi.py','yap4py/yap.py','yap4py/__main__.py','yap4py/__init_.py'],
# package_data=package_data,
2017-09-19 13:19:13 +01:00
include_package_data=True,
2018-03-26 11:03:08 +01:00
data_files = data_files,
# requirements=[
# 'm2w64-gmp',
# 'm2-msys2-keyring',
# 'm2-msys2-launcher-git',
# 'm2-msys2-runtime',
# ],
2017-09-19 13:19:13 +01:00
description="YAP in Python",
author='YAP Development Team',
2018-03-26 11:03:08 +01:00
author_email='vsc@dcc.fc.up.pt',
url='http://www.dcc.fc.up/~vsc/yap',
2017-09-19 13:19:13 +01:00
license='BSD',
platforms="Linux, Mac OS X, Windows",
keywords=['Interactive', 'Interpreter', 'Shell', 'Web'],
2017-05-19 10:03:49 +01:00
classifiers=[
'Intended Audience :: Developers',
2017-09-19 13:19:13 +01:00
'Intended Audience :: System Administrators',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
2017-05-19 10:03:49 +01:00
'Programming Language :: Python :: 3',
2017-09-19 13:19:13 +01:00
],
2017-05-19 10:03:49 +01:00
)
2017-09-19 13:19:13 +01:00
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)