diff --git a/.github/workflows/bld_wheels_and_upload.yml b/.github/workflows/bld_wheels_and_upload.yml index e56d8c0e..5704069d 100644 --- a/.github/workflows/bld_wheels_and_upload.yml +++ b/.github/workflows/bld_wheels_and_upload.yml @@ -1,14 +1,19 @@ name: Build and upload to PyPI -# Build on every branch push, tag push, and pull request change: +# Build on every workflow_dispatch, branch push, tag push, and pull request change on: - #workflow_dispatch: + workflow_dispatch: + pull_request: push: branches: - - WheelSupport + - master + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + jobs: build_wheels_windows_64: - name: Build wheels on ${{ matrix.os }} 64-bit + name: Build wheels on ${{ matrix.os }} 64-bit runs-on: ${{ matrix.os }} strategy: matrix: @@ -16,10 +21,10 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build wheels - uses: pypa/cibuildwheel@v2.12.1 + uses: pypa/cibuildwheel@v2.12.2 env: - CIBW_SKIP: "*-win32" - CIBW_SKIP: "*pp3*" + CIBW_BUILD: "*-win_amd64" + CIBW_SKIP: "cp36-* pp*" - uses: actions/upload-artifact@v3 with: path: ./wheelhouse/*.whl @@ -33,9 +38,10 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build wheels - uses: pypa/cibuildwheel@v2.12.1 + uses: pypa/cibuildwheel@v2.12.2 env: CIBW_BUILD: "*-win32" + CIBW_SKIP: "cp36-* pp*" - uses: actions/upload-artifact@v3 with: path: ./wheelhouse/*.whl @@ -45,14 +51,13 @@ jobs: strategy: matrix: os: [macos-latest,ubuntu-latest] - #os: [windows-latest, ubuntu-latest] steps: - uses: actions/checkout@v3 - name: Build wheels - uses: pypa/cibuildwheel@v2.12.1 + uses: pypa/cibuildwheel@v2.12.2 env: CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 - CIBW_SKIP: "*-musllinux_* pp*" + CIBW_SKIP: "cp36-* *-musllinux_* pp* *-*linux_{aarch64,ppc64le}" CIBW_REPAIR_WHEEL_COMMAND_LINUX: auditwheel repair --exclude libdb2.so.1 @@ -75,14 +80,33 @@ jobs: steps: - uses: actions/checkout@v3 - name: Install Python dependencies - run: | - python -m pip install --upgrade pip build + run: python -m pip install --upgrade pip build - name: Build sdist run: python -m build --sdist --no-isolation + - name: Package version + id: version + run: | + cd dist + pip install ibm_db* + echo "VERSION=$(python -c 'import ibm_db; print(ibm_db.__version__)')" >> $GITHUB_OUTPUT + - name: Build source distribution + run: | + PACKAGE="ibm_db-$VERSION" + cd dist + tar -xzf $PACKAGE.tar.gz + rm -rf $PACKAGE/clidriver* + rm -rf $PACKAGE.tar.gz + tar -czf $PACKAGE.tar.gz $PACKAGE + rm -rf $PACKAGE + env: + VERSION: ${{ steps.version.outputs.VERSION}} - name: Upload sdist uses: actions/upload-artifact@v3 with: - path: ./dist/*.tar.gz + path: | + ./dist/*.tar.gz + + upload_pypi: needs: [build_sdist,build_wheels_macos_linux, build_wheels_windows_64,build_wheels_windows_32] runs-on: ${{ matrix.os }} @@ -90,25 +114,25 @@ jobs: matrix: os: [ubuntu-latest] #upload to PyPI on every tag starting with 'v' - #if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') - # alternatively, to publish when a GitHub Release is created, use the following rule: - # if: github.event_name == 'release' && github.event.action == 'published' + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') steps: - - uses: actions/download-artifact@v3 - with: - # unpacks default artifact into dist/ - # if `name: artifact` is omitted, the action will create extra parent dir - name: Upload to testpypi - path: dist - - uses: pypa/gh-action-pypi-publish@v1.5.0 - with: - user: ${{secrets.TESTPYPI_USER}} - password: ${{secrets.TESTPYPI_PASSWORD}} - repository_url: https://test.pypi.org/legacy/ - skip_existing: true - - - name: Upload to PYPI - uses: pypa/gh-action-pypi-publish@master - with: - user: ${{secrets.TESTPYPI_USER}} - password: ${{secrets.TESTPYPI_PASSWORD}} + - uses: actions/download-artifact@v3 + with: + # unpacks default artifact into dist/ + #if `name: artifact` is omitted, the action will create extra parent dir + name: artifact + path: dist + - name: Publish distribution to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: ${{secrets.TESTPYPI_USER}} + password: ${{ secrets.TESTPYPI_PASSWORD}} + repository-url: https://test.pypi.org/legacy/ + skip-existing: true + - name: Publish distribution to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: ${{secrets.PYPI_USER}} + password: ${{ secrets.PYPI_PASSWORD}} + diff --git a/CHANGES.md b/CHANGES.md index db104e47..838c371d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,22 @@ +2023-08-08, Version 3.1.5 +========================= + + * Fix for issue #857 (Earammak) + + * Support for Null value for an array (Earammak) + + * Fix for issue #838 (Earammak) + + * Code change #837 and readme update (Earammak) + + * Optimize _checkGcc in setup.py (pschoen-itsc) + + * Initial wheel support code changes (Earammak) + + * Fix for issues #823 and #828 (Earammak) + + * Readme update for latest python #813 and Readme update #814 (Earammak) + 2022-11-24, Version 3.1.4 ========================= diff --git a/README.md b/README.md index 600ac0cd..a8dd5d66 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Provides Python interface for connecting to IBM Db2 for LUW, IBM Informix and IB ## Pre-requisites -Install Python 2.7 or Python 3 <= 3.11. The minimum python version supported by driver is python 2.7 and the latest version supported is python 3.11 except version 3.3 as it has reached end-of-life. +Install Python 3.7 <= 3.11. The minimum python version supported by driver is python 3.7 and the latest version supported is python 3.11. > **For MacOS M1 / Apple Silicon chip system** > @@ -62,18 +62,6 @@ Install Python 2.7 or Python 3 <= 3.11. The minimum python version supported by > ``` > 2. When regular installation does not work, it might help to preface your installation command with `ARCHFLAGS="-arch x86_64"`. Be sure to have uninstalled `ibm_db` before installing again, otherwise this fix won't help. -The pre-built 32-bit and 64-bit binaries on windows are available for the following versions: -``` -python 2.7 -python 3.4 -python 3.5 -python 3.6 -python 3.7 -python 3.8 -python 3.9 -python 3.10 -python 3.11 -``` You might need zlib, openssl, pip installations if not already available in your setup. @@ -109,7 +97,8 @@ If you have to use your own URL for clidriver please set environment variable IBM_DB_INSTALLER_URL ``` -If you are using python 3.8 or 3.9 on windows and building the source manually, you will need to set dll path of dependent library of clidriver before importing the module as: +Note: For windows after installing ibm_db, we need to make sure to set dll path of dependent library of clidriver before importing the module as: + ``` import os os.add_dll_directory('path to clidriver installation until bin') diff --git a/ibm_db.c b/ibm_db.c index d4997c7c..f085a4b8 100644 --- a/ibm_db.c +++ b/ibm_db.c @@ -22,7 +22,7 @@ +--------------------------------------------------------------------------+ */ -#define MODULE_RELEASE "0.0.12" +#define MODULE_RELEASE "3.1.4" #include #include @@ -12405,6 +12405,7 @@ INIT_ibm_db(void) { PyModule_AddIntConstant(m, "SQL_ATTR_PARAM_BIND_TYPE", SQL_ATTR_PARAM_BIND_TYPE); PyModule_AddIntConstant(m, "SQL_PARAM_BIND_BY_COLUMN", SQL_PARAM_BIND_BY_COLUMN); PyModule_AddIntConstant(m, "SQL_ATTR_XML_DECLARATION", SQL_ATTR_XML_DECLARATION); +#ifndef __MVS__ PyModule_AddIntConstant(m, "SQL_ATTR_CLIENT_APPLCOMPAT", SQL_ATTR_CLIENT_APPLCOMPAT); PyModule_AddIntConstant(m, "SQL_ATTR_CURRENT_PACKAGE_SET", SQL_ATTR_CURRENT_PACKAGE_SET); PyModule_AddIntConstant(m, "SQL_ATTR_ACCESS_MODE", SQL_ATTR_ACCESS_MODE); @@ -12491,6 +12492,7 @@ INIT_ibm_db(void) { PyModule_AddIntConstant(m, "SQL_ATTR_IGNORE_SERVER_LIST",SQL_ATTR_IGNORE_SERVER_LIST); PyModule_AddIntConstant(m, "SQL_ATTR_DECFLOAT_ROUNDING_MODE", SQL_ATTR_DECFLOAT_ROUNDING_MODE); PyModule_AddIntConstant(m, "SQL_ATTR_PING_DB", SQL_ATTR_PING_DB); +#endif PyModule_AddIntConstant(m, " SQL_ATTR_TXN_ISOLATION", SQL_ATTR_TXN_ISOLATION); return MOD_RETURN_VAL(m); } diff --git a/ibm_db_dbi.py b/ibm_db_dbi.py index c2879da1..496cc65b 100644 --- a/ibm_db_dbi.py +++ b/ibm_db_dbi.py @@ -1289,7 +1289,7 @@ def _set_cursor_helper(self): self.messages.append(_get_exception(inst)) raise self.messages[len(self.messages) - 1] if not num_columns: - return True + return False self._result_set_produced = True return True @@ -1406,8 +1406,8 @@ def execute(self, operation, parameters=None): self.__description = None self._all_stmt_handlers = [] self._prepare_helper(operation) - self._set_cursor_helper() self._execute_helper(parameters) + self._set_cursor_helper() return self._set_rowcount() def executemany(self, operation, seq_parameters): diff --git a/install.md b/install.md index 7313dfd6..f9b0f652 100644 --- a/install.md +++ b/install.md @@ -25,6 +25,32 @@ Below steps were followed for the same: - NOTE(Default behaviour): - IBM_DB_HOME is the HLQ for your Db2 libraries(SDSNMACS, SDSNC.H) + + - For compatibility with python ibm_db the following parameters must be set in the ODBC ini file + CURRENTAPPENSCH=ASCII or CURRENTAPPENSCH=UNICODE (CURRENTAPPENSCH=EBCDIC is not supported) + MULTICONTEXT=2 + FLOAT=IEEE + e.g. + ```; This is a comment line... + ; Example COMMON stanza + [COMMON] + MVSDEFAULTSSID=VC1A + CONNECTTYPE=1 + MULTICONTEXT=2 + CURRENTAPPENSCH=ASCII + FLOAT=IEEE + ; Example SUBSYSTEM stanza for VC1A subsystem + [VC1A] + MVSATTACHTYPE=RRSAF + PLANNAME=DSNACLI + ; Example DATA SOURCE stanza for STLEC1 data source + [STLEC1] + AUTOCOMMIT=1 + CURSORHOLD=1 + ``` + - The ODBC ini file must be encoded in IBM-1047 and cannot have the text tag on, e.g., + chtag -b $DSNAOINI or chtag -m -c IBM-1047 $DSNAOINI. + Use chtag -p $DSNAOINI to verify that the file have T=off (text tag off) and is either tagged binary or mixed IBM-1047. e.g. diff --git a/pyproject.toml b/pyproject.toml index aa756fc9..a2fb14f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,4 +2,4 @@ requires = ["setuptools"] build-backend = "setuptools.build_meta" [tool.cibuildwheel.macos] -repair-wheel-command = "delocate-wheel --ignore-missing-dependencies --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" \ No newline at end of file +repair-wheel-command = "delocate-wheel --ignore-missing-dependencies --require-archs {delocate_archs} -w {dest_dir} -v {wheel}" diff --git a/setup.py b/setup.py index 44696c72..ffa19263 100644 --- a/setup.py +++ b/setup.py @@ -24,8 +24,8 @@ from setuptools.command.build_ext import build_ext from setuptools.command.install import install -PACKAGE = 'ibm_db_wheel' -VERSION = '0.0.12' +PACKAGE = 'ibm_db' +VERSION = '3.1.4' LICENSE = 'Apache License 2.0' readme = os.path.join(os.path.dirname(__file__),'README.md') @@ -461,7 +461,7 @@ def print_exception( e, url): (get_python_lib(), ['./LICENSE']), (get_python_lib(), ['./config.py.sample'])] -modules = ['ibm_db','ibm_db_dbi', 'testfunctions', 'ibmdb_tests'] +modules = ['ibm_db_dbi', 'testfunctions', 'ibmdb_tests'] if 'zos' == sys.platform: ext_modules = _ext_modules(os.path.join(os.getcwd(), include_dir), library, ibm_db_lib, ibm_db_lib_runtime) @@ -500,11 +500,6 @@ def print_exception( e, url): 'Operating System :: Microsoft :: Windows :: Windows 10', 'Operating System :: Unix', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9',