Skip to content

Commit ad0c8df

Browse files
committed
Strip the install and package dependencies
1 parent 380cb68 commit ad0c8df

File tree

5 files changed

+38
-23
lines changed

5 files changed

+38
-23
lines changed

.travis/script.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ if [ -n "${OPENSSL}" ]; then
77
source .travis/openssl-config.sh
88
export PATH="${HOME}/${OPENSSL_DIR}/bin:${PATH}"
99
export CFLAGS="${CFLAGS} -I${HOME}/${OPENSSL_DIR}/include"
10-
# rpath on linux will cause it to use an absolute path so we don't need to
11-
# do LD_LIBRARY_PATH
1210
export LDFLAGS="-L${HOME}/${OPENSSL_DIR}/lib -Wl,-rpath=${HOME}/${OPENSSL_DIR}/lib"
11+
export LD_LIBRARY_PATH="${HOME}/${OPENSSL_DIR}/lib:${LD_LIBRARY_PATH}"
1312
fi
1413

1514

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ are located on the [wiki][WIKI_DEVS].
1717
Ready to use [AppImage][APPIMAGE] distributions of [Python][PYTHON] are provided
1818
[below](##Downloads) or in the [release][RELEASE] area. A one liner example is:
1919
```
20-
wget -cq https://github.com/niess/linuxdeploy-plugin-python/releases/download/continuous/python3-$(arch).AppImage && chmod u+x python3-$(arch).AppImage && ./python3-$(arch).AppImage
20+
wget -cq https://github.com/niess/linuxdeploy-plugin-python/releases/download/continuous/python3-x86_64.AppImage && chmod u+x python3-x86_64.AppImage && ./python3-x86_64.AppImage
2121
```
2222
which will install and run a [Python][PYTHON] instance. See the instructions on
2323
the [wiki][WIKI_USERS] for more detailed usage.

linuxdeploy-plugin-python.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ fi
134134

135135
# Prune the install
136136
cd "$APPDIR/usr"
137-
rm -rf "bin/python"*"-config" "bin/idle"* "include" "lib/pkgconfig" "share/doc" "share/man"
137+
rm -rf "bin/python"*"-config" "bin/idle"* "include" "lib/pkgconfig" \
138+
"share/doc" "share/man" "lib/libpython"*".a" "lib/python"*"/test" \
139+
"lib/python"*"/config-"*"-x86_64-linux-gnu"
140+
138141

139142

140143
# Wrap the Python executables

share/python-wrapper.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
export LD_LIBRARY_PATH="${APPDIR}/usr/lib:${LD_LIBRARY_PATH}"
4+
35
# Resolve symlinks within the image
46
nickname="{{PYTHON}}"
57
executable="${APPDIR}/usr/bin/${nickname}"

tests/test_plugin.py

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_python3_base(self):
8686
"""
8787
appimage, version = "python3-x86_64.AppImage", PYTHON3_VERSION
8888
if not os.path.exists(os.path.join(TESTDIR, appimage)):
89-
self.build_python_appimage("python3")
89+
self.build_python_appimage(PYTHON3_VERSION)
9090
self.check_base(appimage, version)
9191

9292

@@ -103,7 +103,7 @@ def test_python2_base(self):
103103
appimage, version = "python2-x86_64.AppImage", PYTHON2_VERSION
104104
if not os.path.exists(os.path.join(TESTDIR, appimage)):
105105
self.build_python_appimage(
106-
"python2", PYTHON_SOURCE=python_url(version))
106+
PYTHON2_VERSION, PYTHON_SOURCE=python_url(version))
107107
self.check_base(appimage, version)
108108

109109

@@ -181,9 +181,12 @@ def bash(cmd):
181181
version, str(python)))
182182

183183

184-
def build_python_appimage(self, exe, **kwargs):
184+
def build_python_appimage(self, version, **kwargs):
185185
"""Build a Python AppImage using linux-deploy-python
186186
"""
187+
nickname = "python" + version[0]
188+
exe = ".python" + version[:3]
189+
187190
appdir = TESTDIR + "/AppDir"
188191
if os.path.exists(appdir):
189192
shutil.rmtree(appdir)
@@ -194,33 +197,41 @@ def build_python_appimage(self, exe, **kwargs):
194197

195198
# Create generic resources for the application deployement
196199
src = ROOTDIR + "/appimage/resources/linuxdeploy-plugin-python.png"
197-
icon = os.path.join(resdir, exe + ".png")
200+
icon = os.path.join(resdir, nickname + ".png")
198201
shutil.copy(src, icon)
199202

200-
desktop = os.path.join(resdir, exe + ".desktop")
203+
desktop = os.path.join(resdir, nickname + ".desktop")
201204
with open(desktop, "w") as f:
202205
f.write("""\
203206
[Desktop Entry]
204207
Categories=Science;Engineering;
205208
Type=Application
206209
Icon={0:}
207-
Exec={0:}
210+
Exec={1:}
208211
Name={0:}
209-
""".format(exe))
210-
211-
command = ("./" + LINUX_DEPLOY,
212-
"--appdir", str(appdir),
213-
"-i", str(icon),
214-
"-d", str(desktop),
215-
"--plugin", "python",
216-
"--output", "appimage")
217-
218-
env = os.environ.copy()
219-
env.update(kwargs)
220-
system(" ".join(command), env=env)
212+
""".format(nickname, exe))
213+
214+
for index in range(2):
215+
command = ["./" + LINUX_DEPLOY,
216+
"--appdir", appdir,
217+
"-i", icon,
218+
"-d", desktop]
219+
if index == 0:
220+
command += [
221+
"--plugin", "python"]
222+
else:
223+
command += [
224+
"-e", os.path.join(appdir, "usr", "bin", exe),
225+
"--custom-apprun", os.path.join(appdir, "usr", "bin",
226+
nickname),
227+
"--output", "appimage"]
228+
229+
env = os.environ.copy()
230+
env.update(kwargs)
231+
system(" ".join(command), env=env)
221232

222233
shutil.copy(
223-
TESTDIR + "/{:}-{:}.AppImage".format(exe, os.environ["ARCH"]),
234+
TESTDIR + "/{:}-{:}.AppImage".format(nickname, os.environ["ARCH"]),
224235
ROOTDIR + "/appimage")
225236

226237

0 commit comments

Comments
 (0)