Skip to content

Commit 05246f0

Browse files
committed
Support Linux
1 parent 49c61b7 commit 05246f0

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
2+
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
3+
4+
name: Maven Package
5+
6+
on:
7+
push:
8+
branches: [main]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-20.04
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up JDK 1.8
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: 1.8
21+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
22+
settings-path: ${{ github.workspace }} # location for the settings.xml file
23+
24+
- name: Build with Maven
25+
run: mvn -B package --file pom.xml
26+
27+
- name: Publish to GitHub Packages Apache Maven
28+
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
29+
env:
30+
GITHUB_TOKEN: ${{ github.token }}

pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,12 @@
131131
<connection>scm:git:git://github.com/bytedeco/javacpp-embedded-python.git</connection>
132132
<developerConnection>scm:git:ssh://[email protected]/bytedeco/javacpp-embedded-python.git</developerConnection>
133133
</scm>
134+
135+
<distributionManagement>
136+
<repository>
137+
<id>github</id>
138+
<name>GitHub Packages</name>
139+
<url>https://maven.pkg.github.com/bytedeco/javacpp-embedded-python</url>
140+
</repository>
141+
</distributionManagement>
134142
</project>

src/main/java/org/bytedeco/embeddedpython/Python.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import static java.nio.charset.StandardCharsets.UTF_8;
2020
import static org.bytedeco.cpython.global.python.*;
21+
import static org.bytedeco.cpython.global.python.Py_DecodeLocale;
2122
import static org.bytedeco.cpython.helper.python.Py_AddPath;
2223
import static org.bytedeco.cpython.presets.python.cachePackages;
2324
import static org.bytedeco.embeddedpython.PyTypes.*;
@@ -51,11 +52,11 @@ private static void init() throws IOException {
5152
Py_AddPath(new File(cachePackages()[0], "site-packages"));
5253
}
5354

54-
_Py_SetProgramFullPath(new CharPointer(Loader.load(org.bytedeco.cpython.python.class)));
55+
_Py_SetProgramFullPath(Py_DecodeLocale(Loader.load(org.bytedeco.cpython.python.class), null));
5556

5657
Py_UnbufferedStdioFlag(1);
5758
Py_Initialize();
58-
PySys_SetArgvEx(1, new PointerPointer<CharPointer>(1).put(new CharPointer("")), 0);
59+
PySys_SetArgvEx(1, new PointerPointer<>(1).put(Py_DecodeLocale("", null)), 0);
5960
_import_array();
6061

6162
Runtime.getRuntime().addShutdownHook(new Thread(python::Py_Finalize));

0 commit comments

Comments
 (0)