Skip to content

Commit b0bead4

Browse files
Added support for maintainers to specify optional compilation arguments
when building python-oracledb.
1 parent f715085 commit b0bead4

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

doc/src/release_notes.rst

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ Thick Mode Changes
2525
Common Changes
2626
++++++++++++++
2727

28+
#) Added support for maintainers to specify optional compilation arguments
29+
when building python-oracledb. A new environment variable
30+
``PYO_COMPILE_ARGS`` can be set :ref:`before building <installsrc>`.
31+
#) Python wheel package binaries for Linux on `PyPI
32+
<https://pypi.org/project/oracledb/>`__ are now stripped to reduce their
33+
size.
2834
#) Error ``DPY-2049: invalid flags for tpc_begin()`` is now raised when
2935
invalid flags are passed to :meth:`Connection.tpc_begin()`. Previously,
3036
``TypeError`` or ``ORA-24759: invalid transaction start flags``

doc/src/user_guide/installation.rst

+24-9
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,8 @@ To use python-oracledb without the cryptography package:
853853
- Add a call to :meth:`oracledb.init_oracle_client()` in your application, see
854854
:ref:`enablingthick`.
855855

856+
.. _installsrc:
857+
856858
Installing from Source Code
857859
===========================
858860

@@ -866,6 +868,16 @@ code:
866868

867869
- C Compiler: A C99 compiler is needed.
868870

871+
**Optional Compilation Arguments**
872+
873+
Before building python-oracledb, the optional environment variable
874+
``PYO_COMPILE_ARGS`` can be set to change the compilation arguments. For
875+
example, to build stripped binaries on Linux, first set::
876+
877+
export PYO_COMPILE_ARGS='-g0'
878+
879+
After this, one of the following installation methods can be used.
880+
869881
.. _installgh:
870882

871883
Install Using GitHub
@@ -879,8 +891,20 @@ commands::
879891
python setup.py build
880892
python setup.py install
881893

894+
If you do not have access to system directories, the ``--user`` option can be
895+
used to install into a local directory::
896+
897+
python setup.py install --user
898+
899+
Note that if you download a source zip file directly from GitHub then you will
900+
also need to download an `ODPI-C <https://github.com/oracle/odpi>`__ source zip
901+
file and put the extracted contents inside the "odpi" subdirectory, for example
902+
in "python-oracledb-main/src/oracledb/impl/thick/odpi".
903+
882904
.. _whlpkg:
883905

906+
**Creating a package for installation**
907+
884908
To create a package suitable for installing on other computers, run the
885909
following commands::
886910

@@ -896,15 +920,6 @@ version. To install the wheel, run::
896920

897921
python -m pip install oracledb-2.2.0-cp312-cp312-macosx_10_9_universal2.whl
898922

899-
If you do not have access to system directories, the ``--user`` option can be
900-
used to install into a local directory::
901-
902-
python setup.py install --user
903-
904-
Note that if you download a source zip file directly from GitHub then you will
905-
also need to download an `ODPI-C <https://github.com/oracle/odpi>`__ source zip
906-
file and put the extracted contents inside the "odpi" subdirectory, for example
907-
in "python-oracledb-main/src/oracledb/impl/thick/odpi".
908923

909924
Install Using opensource.oracle.com
910925
-----------------------------------

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
# - add argument required for cross-compilation for both x86_64 and arm64
7777
# architectures if the python interpreter is a universal2 version.
7878

79-
extra_compile_args = []
79+
extra_compile_args = os.environ.get("PYO_COMPILE_ARGS", "").split()
8080
if sys.platform == "darwin":
8181
extra_compile_args.extend(["-mmacosx-version-min=10.9"])
8282
if "universal2" in sysconfig.get_platform():

0 commit comments

Comments
 (0)