-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing license classifier #33
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7f01ef8
Rename master to main
tibdex d26f435
Add license classifier
tibdex d913237
Bump lib version
tibdex 26c5277
Test on Python 3.9 too
tibdex a7381b2
Make some improvements
tibdex 80cbfbd
Temporary commit
tibdex 5c5c937
Java 11.0.11
tibdex 080af64
Try to fix test_java_version
tibdex 52a5c9c
Make some improvements
tibdex 037e4e2
fixup! Make some improvements
tibdex 5d200de
Bump lib version
tibdex 1d15bff
Bump build number instead of lib version
tibdex 1c57910
fixup! Bump build number instead of lib version
tibdex f6d1283
fixup! Bump build number instead of lib version
tibdex d90f660
Revert "fixup! Bump build number instead of lib version"
tibdex bec15ca
Fix workflow files
tibdex 650e197
fixup! Fix workflow files
tibdex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,45 @@ | ||
"""JDK packaged for Python.""" | ||
|
||
from typing import Union, List, Optional, Any | ||
from pathlib import Path | ||
from subprocess import Popen | ||
from typing import Any, Collection, Optional, Union | ||
|
||
_PACKAGE_DIRECTORY = Path(__file__).parent | ||
|
||
JAVA_HOME = _PACKAGE_DIRECTORY.absolute() / "java-runtime" | ||
JAVA = JAVA_HOME / "bin" / "java" | ||
|
||
JAVA_VERSION, LIB_VERSION, MAJOR_JAVA_VERSION = ( | ||
JAVA_VERSION, LIB_VERSION = ( | ||
(_PACKAGE_DIRECTORY / filename).read_text().strip() | ||
for filename in ("java_version.txt", "lib_version.txt", "major_java_version.txt") | ||
for filename in ("java_version.txt", "lib_version.txt") | ||
) | ||
|
||
__version__ = ".".join((JAVA_VERSION, LIB_VERSION)) | ||
|
||
|
||
def java( | ||
java_args: List[str], | ||
jvm_args: Collection[str], | ||
**popen_args: Any, | ||
) -> Popen: | ||
"""Run a Java process with the given arguments. | ||
|
||
Args: | ||
jvm_args: The Java arguments, for instance ["HelloWorls.class", "-Xmx16G"] | ||
popen_args: Additional arguments to pass to the Popen | ||
|
||
Returns: | ||
The Popen process | ||
jvm_args: The Java arguments, for instance: ``["HelloWorls.class", "-Xmx16G"]``. | ||
popen_args: Additional arguments to pass to ``Popen``. | ||
""" | ||
return Popen([str(JAVA), *java_args], **popen_args) | ||
return Popen([str(JAVA), *jvm_args], **popen_args) | ||
|
||
|
||
def execute_jar( | ||
jar_path: Union[Path, str], | ||
jvm_args: Optional[List[str]] = None, | ||
jvm_args: Optional[Collection[str]] = None, | ||
**popen_args: Any, | ||
) -> Popen: | ||
"""Execute a JAR file. | ||
|
||
Args: | ||
jar_path: The path to the JAR file | ||
jvm_args: The JVM arguments, for instance ["-Xmx16G", "-Xms2G"] | ||
popen_args: Additional arguments to pass to the Popen | ||
|
||
Returns: | ||
The Popen process | ||
jar_path: The path to the JAR file. | ||
jvm_args: The JVM arguments, for instance ``["-Xmx16G", "-Xms2G"]``. | ||
popen_args: Additional arguments to pass to ``Popen``. | ||
""" | ||
if jvm_args is None: | ||
jvm_args = [] | ||
return java(["-jar", str(jar_path), *jvm_args], **popen_args) | ||
return java(["-jar", str(jar_path), *(jvm_args or [])], **popen_args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from os import environ | ||
from pathlib import Path | ||
from typing import Mapping | ||
|
||
_PROJECT_DIRECTORY = Path(__file__).parent.parent | ||
_SOURCE_DIRECTORY = _PROJECT_DIRECTORY / "jdk4py" | ||
|
||
|
||
def set_env_variables_in_github_job(variables: Mapping[str, str]): | ||
# See https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable. | ||
with open(environ["GITHUB_ENV"], "a") as environment_file: | ||
for name, value in variables.items(): | ||
environment_file.write(f"{name}={value}\n") | ||
|
||
|
||
if __name__ == "__main__": | ||
build_number, java_version, lib_version = ( | ||
(_SOURCE_DIRECTORY / filename).read_text().strip() | ||
for filename in ("build_number.txt", "java_version.txt", "lib_version.txt") | ||
) | ||
|
||
set_env_variables_in_github_job( | ||
{ | ||
"JAVA_VERSION": java_version, | ||
"JDK4PY_BUILD_NUMBER": build_number, | ||
"JDK4PY_VERSION": ".".join((java_version, lib_version)), | ||
} | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the build number ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because to be consistent, we should add one too here:
https://github.com/atoti/jdk4py/blob/8810e2faad3b7eb9fee980a99ce1ae686ea6e2a4/.github/workflows/deployment.yaml#L55
And make sure that they are kept in sync.
We could do this in a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, let's do it now and try to fix atoti/atoti#279 without having to publish a new version of atoti or fighting pip/poetry/conda to ignore the pinned version of jdk4py in atoti.