|
5 | 5 | """ |
6 | 6 |
|
7 | 7 | 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 |
15 | 13 | 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 |
17 | 21 |
|
18 | 22 | class test(Command): |
19 | 23 | # Original version of this class posted |
@@ -68,22 +72,13 @@ def run(self): |
68 | 72 | qle_swig_dir = os.path.join("QuantExt-SWIG","SWIG") |
69 | 73 | oredata_swig_dir = os.path.join("OREData-SWIG","SWIG") |
70 | 74 | 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")) |
87 | 82 |
|
88 | 83 | class my_build(build): |
89 | 84 | user_options = build.user_options + [ |
@@ -264,13 +259,6 @@ def finalize_options(self): |
264 | 259 |
|
265 | 260 | datafiles = [] |
266 | 261 |
|
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 | | - |
274 | 262 | classifiers = [ |
275 | 263 | 'Development Status :: 5 - Production/Stable', |
276 | 264 | 'Environment :: Console', |
|
0 commit comments