Skip to content

Commit c8857d4

Browse files
author
Eric Ehlers
committed
Update the python wheels build
1 parent 9e7fa57 commit c8857d4

2 files changed

Lines changed: 29 additions & 39 deletions

File tree

ORE-SWIG/setup.py

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@
55
"""
66

77
import os, sys, math, codecs
8-
from distutils.cmd import Command
9-
from distutils.command.build_ext import build_ext
10-
from distutils.command.build import build
11-
from distutils.ccompiler import get_default_compiler
12-
try:
13-
from setuptools import setup, Extension
14-
except:
8+
if sys.version_info < (3,10):
9+
from distutils.cmd import Command
10+
from distutils.command.build_ext import build_ext
11+
from distutils.command.build import build
12+
from distutils.ccompiler import get_default_compiler
1513
from distutils.core import setup, Extension
16-
from distutils import sysconfig
14+
from distutils import sysconfig
15+
else:
16+
from setuptools import Command
17+
from setuptools.command.build_ext import build_ext
18+
from setuptools.command.build import build
19+
from setuptools._distutils.ccompiler import get_default_compiler
20+
from setuptools import setup, Extension
1721

1822
class test(Command):
1923
# Original version of this class posted
@@ -68,22 +72,13 @@ def run(self):
6872
qle_swig_dir = os.path.join("QuantExt-SWIG","SWIG")
6973
oredata_swig_dir = os.path.join("OREData-SWIG","SWIG")
7074
orea_swig_dir = os.path.join("OREAnalytics-SWIG","SWIG")
71-
if sys.version_info.major >= 3:
72-
os.system('swig -python -c++ ' +
73-
'-I%s ' % ql_swig_dir +
74-
'-I%s ' % qle_swig_dir +
75-
'-I%s ' % oredata_swig_dir +
76-
'-I%s ' % orea_swig_dir +
77-
'-o oreanalytics_wrap.cpp ' +
78-
os.path.join("OREAnalytics-SWIG","SWIG","oreanalytics.i"))
79-
else:
80-
os.system('swig -python -c++ ' +
81-
'-I%s ' % ql_swig_dir +
82-
'-I%s ' % qle_swig_dir +
83-
'-I%s ' % oredata_swig_dir +
84-
'-I%s ' % orea_swig_dir +
85-
'-o oreanalytics_wrap.cpp ' +
86-
os.path.join("OREAnalytics-SWIG","SWIG","oreanalytics.i"))
75+
os.system('swig -python -c++ ' +
76+
'-I%s ' % ql_swig_dir +
77+
'-I%s ' % qle_swig_dir +
78+
'-I%s ' % oredata_swig_dir +
79+
'-I%s ' % orea_swig_dir +
80+
'-o oreanalytics_wrap.cpp ' +
81+
os.path.join("OREAnalytics-SWIG","SWIG","oreanalytics.i"))
8782

8883
class my_build(build):
8984
user_options = build.user_options + [
@@ -264,13 +259,6 @@ def finalize_options(self):
264259

265260
datafiles = []
266261

267-
# patch distutils if it can't cope with the "classifiers" or
268-
# "download_url" keywords
269-
if sys.version < '2.2.3':
270-
from distutils.dist import DistributionMetadata
271-
DistributionMetadata.classifiers = None
272-
DistributionMetadata.download_url = None
273-
274262
classifiers = [
275263
'Development Status :: 5 - Production/Stable',
276264
'Environment :: Console',

ORE-SWIG/tutorials.03.build_windows.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ its prerequisites, e.g:
4848
SET ZLIB_ROOT=C:\repos\vcpkg\packages\zlib_x64-windows (optional)
4949
SET ORE_DIR=C:\repos\ore
5050

51-
# Build ORE and ORE-SWIG
51+
# Build ORE and ORESWIG
5252

53-
There are two ways to build ORESWIG: using **cmake**, or using **setup.py**.
54-
With cmake, you can generate the wrapper. With setup.py you can generate both
55-
the wrapper and the wheel. Regardless, ORE libraries must be built first.
53+
You can use **cmake** to build ORE and the ORESWIG wrapper. You can use
54+
**setup.py** to build the ORESWIG wrapper and wheel. If you use setup.py to
55+
build ORE-SWIG, you must first build ORE.
5656

5757
## Build ORE/ORESWIG via CMake
5858

@@ -70,7 +70,7 @@ Make sure to add the location of the ORE-SWIG package to your PYTHONPATH, e.g:
7070

7171
SET PYTHONPATH=%ORE_DIR%\build\ORE-SWIG;%ORE_DIR%\build\ORE-SWIG\Release
7272

73-
## Build ORE/ORESWIG via setup.py
73+
## Build ORESWIG via setup.py
7474

7575
If using the setup.py method, you would have to build ORE with cmake as
7676
demonstrated above, but, when configuring cmake, disable the SWIG build with:
@@ -84,6 +84,8 @@ we create a virtual environment into which we install the packages required by
8484
setup.py.
8585

8686
cd %ORE_DIR%\ORE-SWIG
87+
SET BOOST=C:\repos\boost\boost_1_72_0
88+
SET BOOST_LIB64=C:\repos\boost\boost_1_72_0\lib64-msvc-14.2
8789
SET ORE_STATIC_RUNTIME=1
8890
SET ORE_USE_ZLIB=1
8991
SET PATH=%PATH%;C:\path\to\swig
@@ -116,9 +118,9 @@ not then `cube.dat` is generated as a flat (plain text) file.
116118
## Build the wheel with setup.py
117119

118120
Whether you used cmake or setup.py above to build the wrapper, you can use
119-
setup.py to build the wheel. If you used setup.py then you already have the
120-
python virtual environment, and you can reuse it, otherwise you can create a
121-
new one as shown below.
121+
setup.py to build the wheel. If you used setup.py before then you already have
122+
the python virtual environment, and you can reuse it, otherwise you can create
123+
a new one as shown below.
122124

123125
cd %ORE_DIR%\ORE-SWIG
124126
SET BOOST=C:\repos\boost\boost_1_72_0

0 commit comments

Comments
 (0)