Skip to content

Commit

Permalink
Patch jaydebeapi
Browse files Browse the repository at this point in the history
We need to carry a custom patch for jaydebeapi as it doesn't support
latest jpype currently and no release is happening.

See baztian/jaydebeapi#107.
  • Loading branch information
therve committed Nov 4, 2019
1 parent de9b187 commit fc90dd3
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--- a/__init__.py
+++ b/__init__.py
@@ -173,7 +173,19 @@ def _jdbc_connect_jpype(jclassname, url, driver_args, jars, libs):
# jvm_path = ('/usr/lib/jvm/java-6-openjdk'
# '/jre/lib/i386/client/libjvm.so')
jvm_path = jpype.getDefaultJVMPath()
- jpype.startJVM(jvm_path, *args)
+ jpype_ver = 0.
+ if hasattr(jpype, '__version__'):
+ try:
+ ver_match = re.match('\d+\.\d+', jpype.__version__)
+ if ver_match:
+ jpype_ver = float(ver_match.group(0))
+ except ValueError:
+ pass
+ if jpype_ver < 0.7:
+ jpype.startJVM(jvm_path, *args)
+ else:
+ jpype.startJVM(jvm_path, *args, ignoreUnrecognized=True,
+ convertStrings=True)
if not jpype.isThreadAttachedToJVM():
jpype.attachThreadToJVM()
if _jdbc_name_to_const is None:
2 changes: 2 additions & 0 deletions omnibus/config/software/datadog-agent-integrations-py2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@
# Patch applies to only one file: set it explicitly as a target, no need for -p
if windows?
patch :source => "create-regex-at-runtime.patch", :target => "#{python_2_embedded}/Lib/site-packages/yaml/reader.py"
patch :source => "jpype_0_7.patch", :target => "#{python_2_embedded}/Lib/site-packages/jaydebeapi/__init__.py"
else
patch :source => "create-regex-at-runtime.patch", :target => "#{install_dir}/embedded/lib/python2.7/site-packages/yaml/reader.py"
patch :source => "jpype_0_7.patch", :target => "#{install_dir}/embedded/lib/python2.7/site-packages/jaydebeapi/__init__.py"
end

end
Expand Down
7 changes: 7 additions & 0 deletions omnibus/config/software/datadog-agent-integrations-py3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,13 @@
else
command "#{pip} install --no-deps .", :env => nix_build_env, :cwd => "#{project_dir}/#{check}"
end

# Patch applies to only one file: set it explicitly as a target, no need for -p
if windows?
patch :source => "jpype_0_7.patch", :target => "#{python_3_embedded}/Lib/site-packages/jaydebeapi/__init__.py"
else
patch :source => "jpype_0_7.patch", :target => "#{install_dir}/embedded/lib/python2.7/site-packages/jaydebeapi/__init__.py"
end
end
end

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
fixes:
- |
Carry a custom patch for jaydebeapi to support latest jpype.

0 comments on commit fc90dd3

Please sign in to comment.