@@ -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]
204207Categories=Science;Engineering;
205208Type=Application
206209Icon={0:}
207- Exec={0 :}
210+ Exec={1 :}
208211Name={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