|
1 | | -"""Setup script for cx_Oracle. |
2 | | -
|
3 | | -Windows platforms: |
4 | | - python setup.py build --compiler=mingw32 install |
5 | | -
|
6 | | -Unix platforms |
7 | | - python setup.py build install |
8 | | -
|
| 1 | +""" |
| 2 | +Setup script for cx_Oracle. |
9 | 3 | """ |
10 | 4 |
|
11 | 5 | import os |
|
25 | 19 | BUILD_VERSION = "8.2.0-dev" |
26 | 20 |
|
27 | 21 | # setup extra link and compile args |
28 | | -extraLinkArgs = [] |
29 | | -extraCompileArgs = [] |
| 22 | +extra_link_args = [] |
| 23 | +extra_compile_args = [] |
30 | 24 | if sys.platform == "aix4": |
31 | | - extraCompileArgs.append("-qcpluscmt") |
| 25 | + extra_compile_args.append("-qcpluscmt") |
32 | 26 | elif sys.platform == "aix5": |
33 | | - extraCompileArgs.append("-DAIX5") |
| 27 | + extra_compile_args.append("-DAIX5") |
34 | 28 | elif sys.platform == "cygwin": |
35 | | - extraLinkArgs.append("-Wl,--enable-runtime-pseudo-reloc") |
| 29 | + extra_link_args.append("-Wl,--enable-runtime-pseudo-reloc") |
36 | 30 | elif sys.platform == "darwin": |
37 | | - extraLinkArgs.append("-shared-libgcc") |
| 31 | + extra_link_args.append("-shared-libgcc") |
38 | 32 |
|
39 | 33 | # define cx_Oracle sources |
40 | | -sourceDir = "src" |
41 | | -sources = [os.path.join(sourceDir, n) \ |
42 | | - for n in sorted(os.listdir(sourceDir)) if n.endswith(".c")] |
| 34 | +source_dir = "src" |
| 35 | +sources = [os.path.join(source_dir, n) \ |
| 36 | + for n in sorted(os.listdir(source_dir)) if n.endswith(".c")] |
43 | 37 | depends = ["src/cxoModule.h"] |
44 | 38 |
|
45 | 39 | # define ODPI-C sources, libraries and include directories; if the environment |
46 | 40 | # variables ODPIC_INC_DIR and ODPIC_LIB_DIR are both set, assume these |
47 | 41 | # locations contain a compiled installation of ODPI-C; otherwise, use the |
48 | 42 | # source of ODPI-C found in the odpi subdirectory |
49 | | -dpiIncludeDir = os.environ.get("ODPIC_INC_DIR") |
50 | | -dpiLibDir = os.environ.get("ODPIC_LIB_DIR") |
51 | | -if dpiIncludeDir and dpiLibDir: |
52 | | - dpiSources = [] |
53 | | - includeDirs = [dpiIncludeDir] |
| 43 | +dpi_include_dir = os.environ.get("ODPIC_INC_DIR") |
| 44 | +dpi_lib_dir = os.environ.get("ODPIC_LIB_DIR") |
| 45 | +if dpi_include_dir and dpi_lib_dir: |
| 46 | + dpi_sources = [] |
| 47 | + include_dirs = [dpi_include_dir] |
54 | 48 | libraries = ["odpic"] |
55 | | - libraryDirs = [dpiLibDir] |
| 49 | + library_dirs = [dpi_lib_dir] |
56 | 50 | else: |
57 | | - includeDirs = ["odpi/include", "odpi/src"] |
58 | | - dpiSourceDir = os.path.join("odpi", "src") |
59 | | - dpiSources = [os.path.join(dpiSourceDir, n) \ |
60 | | - for n in sorted(os.listdir(dpiSourceDir)) if n.endswith(".c")] |
| 51 | + include_dirs = ["odpi/include", "odpi/src"] |
| 52 | + dpi_source_dir = os.path.join("odpi", "src") |
| 53 | + dpi_sources = [os.path.join(dpi_source_dir, n) \ |
| 54 | + for n in sorted(os.listdir(dpi_source_dir)) if n.endswith(".c")] |
61 | 55 | depends.extend(["odpi/include/dpi.h", "odpi/src/dpiImpl.h", |
62 | 56 | "odpi/src/dpiErrorMessages.h"]) |
63 | 57 | libraries = [] |
64 | | - libraryDirs = [] |
| 58 | + library_dirs = [] |
65 | 59 |
|
66 | 60 | # setup the extension |
67 | 61 | extension = setuptools.Extension( |
68 | | - name = "cx_Oracle", |
69 | | - include_dirs = includeDirs, |
70 | | - extra_compile_args = extraCompileArgs, |
71 | | - define_macros = [("CXO_BUILD_VERSION", BUILD_VERSION)], |
72 | | - extra_link_args = extraLinkArgs, |
73 | | - sources = sources + dpiSources, |
74 | | - depends = depends, |
75 | | - libraries = libraries, |
76 | | - library_dirs = libraryDirs) |
| 62 | + name="cx_Oracle", |
| 63 | + include_dirs=include_dirs, |
| 64 | + extra_compile_args=extra_compile_args, |
| 65 | + define_macros=[("CXO_BUILD_VERSION", BUILD_VERSION)], |
| 66 | + extra_link_args=extra_link_args, |
| 67 | + sources=sources + dpi_sources, |
| 68 | + depends=depends, |
| 69 | + libraries=libraries, |
| 70 | + library_dirs=library_dirs) |
77 | 71 |
|
78 | 72 | # perform the setup |
79 | 73 | setuptools.setup( |
80 | | - version = BUILD_VERSION, |
81 | | - data_files = [ ("cx_Oracle-doc", ["LICENSE.txt", "README.txt"]) ], |
82 | | - ext_modules = [extension]) |
| 74 | + version=BUILD_VERSION, |
| 75 | + data_files=[ ("cx_Oracle-doc", ["LICENSE.txt", "README.txt"]) ], |
| 76 | + ext_modules=[extension]) |
0 commit comments