Skip to content

Commit

Permalink
Fix bug in setup.py where wrong cli file could be downloaded (ibmdb#325
Browse files Browse the repository at this point in the history
)

* Fix the broken links

I read and certify the DCO; as an employee of IBM, they own my work anyway.

* Fix bug in setup.py where wrong cli file could be downloaded

I work for IBM; this work is theirs, so I accept the contributor guidelines.

Anyway, there’s a bug in the setup for ibm_db.  Specifically, when you’re trying to install the command line library.  You have function that looks through everything that’s returned from os.uname() to determine which one to download.  That function looks through all the items returned, which includes (sysname,nodename, release, version, machine).  The problem is that when you’re checking to determine which libraries to download for linux, you look at all those fields, and right now, the release string for RHEL zLinux is '3.10.0-862.el7.s390x’, so if you try installing ibm_db on zLinux, it downloads the cli_libraries for the x86 platform and the install fails.  What I’m proposing you do instead is only look at the machine field to determine the architecture.  I don’t have access to all those types of machines to validate that this is the correct solution, but it does work for zLinux.  I’m assuming you have a place you can validate the other platforms.

* Changing check for the SPARC architecture

Signed-off-by: Kevin McKenzie <[email protected]>
  • Loading branch information
Tam-Lin authored and SabaKauser committed Jul 23, 2018
1 parent 3357893 commit 5d89380
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions IBM_DB/ibm_db/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@
libDir = 'lib32'
sys.stdout.write("Detected 32-bit Python\n")

# check if val exists in list
def _checkOSList(list, val):
for s in list:
if ( val in s):
return True
return False

# defining extension
def _ext_modules(include_dir, library, lib_dir, runtime_dir=None):
ext_args = dict(include_dirs = [include_dir],
Expand Down Expand Up @@ -98,27 +91,27 @@ def _setWinEnv(name, value):
cliFileName = 'aix32_odbc_cli.tar.gz'
elif ('linux' in sys.platform):
os_ = 'linux'
if (_checkOSList(os.uname(),'ppc64le')):
if ('ppc64le' in os.uname()[4]):
os_ = 'ppc64le'
if is64Bit:
cliFileName = 'ppc64le_odbc_cli.tar.gz'
arch_ = 'ppc64le'
elif (_checkOSList(os.uname(),'ppc')):
elif ('ppc' in os.uname()[4]):
os_ = 'ppc'
if is64Bit:
cliFileName = 'ppc64_odbc_cli.tar.gz'
arch_ = 'ppc64'
else:
cliFileName = 'ppc32_odbc_cli.tar.gz'
arch_ = 'ppc*'
elif (_checkOSList(os.uname(),'86')): # todo needs to search in list
elif ('86' in os.uname()[4]): # todo needs to search in list
if is64Bit:
cliFileName = 'linuxx64_odbc_cli.tar.gz'
arch_ = 'x86_64'
else:
cliFileName = 'linuxia32_odbc_cli.tar.gz'
arch_ = 'i686'
elif (_checkOSList(os.uname(),'390')):
elif ('390' in os.uname()[4]):
if is64Bit:
cliFileName = 's390x64_odbc_cli.tar.gz'
arch_ = 's390x'
Expand All @@ -127,13 +120,13 @@ def _setWinEnv(name, value):
arch_ = 's390'
elif ('sunos' in sys.platform):
os_ = 'solaris*'
if ('i86pc' in os.uname()):
if ('i86pc' in os.uname()[4]):
arch_ = 'i86pc'
if is64Bit:
cliFileName = 'sunamd64_odbc_cli.tar.gz'
else:
cliFileName = 'sunamd32_odbc_cli.tar.gz'
elif ('SPARC' in os.uname()):
elif ('sun4' in os.uname()[4]):
arch_ = 'SUNW'
if is64Bit:
cliFileName = 'sun64_odbc_cli.tar.gz'
Expand Down

0 comments on commit 5d89380

Please sign in to comment.