Skip to content

Commit

Permalink
[core] HUE-2334. Make cx_Oracle compilation optional
Browse files Browse the repository at this point in the history
  • Loading branch information
bc Wong committed Oct 28, 2014
1 parent c6f0ffa commit 1b64d0c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
6 changes: 3 additions & 3 deletions desktop/core/ext-py/cx_Oracle-5.1.2/setup.py
Expand Up @@ -118,7 +118,7 @@ def CheckOracleHome(directoryToCheck):
return False

# try to determine the Oracle home
userOracleHome = os.environ.get("ORACLE_HOME")
userOracleHome = os.environ.get("ORACLE_HOME", os.environ.get("ORACLE_INSTANTCLIENT_HOME"))
if userOracleHome is not None:
if not CheckOracleHome(userOracleHome):
messageFormat = "Oracle home (%s) does not refer to an " \
Expand All @@ -129,8 +129,8 @@ def CheckOracleHome(directoryToCheck):
if CheckOracleHome(path):
break
if oracleHome is None:
raise DistutilsSetupError("cannot locate an Oracle software " \
"installation")
print >>sys.stderr, "cannot locate an Oracle software installation. skipping"
sys.exit(0)

# define some variables
if sys.platform == "win32":
Expand Down
15 changes: 15 additions & 0 deletions desktop/core/src/desktop/tests.py
Expand Up @@ -627,3 +627,18 @@ def test_check_config_ajax():
c = make_logged_in_client()
response = c.get(reverse(check_config))
assert_true("misconfiguration" in response.content, response.content)


def test_cx_Oracle():
"""
Tests that cx_Oracle (external dependency) is built correctly.
"""
try:
import cx_Oracle
return
except ImportError, ex:
if "No module named" in ex.message:
assert_true(False, "cx_Oracle skipped its build. This happens if "
"env var ORACLE_HOME or ORACLE_INSTANTCLIENT_HOME is not defined. "
"So ignore this test failure if your build does not need to work "
"with an oracle backend.")

0 comments on commit 1b64d0c

Please sign in to comment.