Skip to content

Commit 6ac5788

Browse files
author
Your Name
committed
Revert "Added wizardless commands (pack and unpack)" and re-implement original solution; add USAGE
1 parent ebb58a4 commit 6ac5788

File tree

3 files changed

+20
-53
lines changed

3 files changed

+20
-53
lines changed

AppImageAssistant.AppDir/AppImageAssistant

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# /**************************************************************************
44
#
5-
# Copyright (c) 2005-13 Simon Peter
5+
# Copyright (c) 2005-15 Simon Peter
66
#
77
# All Rights Reserved.
88
#
@@ -46,51 +46,31 @@ import xdgappdir
4646
import commands
4747
import threading
4848
import glob
49-
import colors
49+
5050

5151
def usage():
5252
print "Usage:"
53-
print " ", colors.BOLD, "--pack, --package", colors.END, "<input AppDir>", "<output AppImage>"
54-
print " "*6, "Create an AppImage from an AppDir"
55-
print " ", colors.BOLD, "--unpack, --extract", colors.END, "<input AppImage>", "<output AppDir>", "[<path inside AppImage>]"
56-
print " "*6, "Extract an AppImage to an AppDir"
57-
print " ", colors.BOLD, "-h, --help", colors.END
58-
print " "*6, "Show this help message"
59-
print " ", colors.BOLD, "<no arguments>", colors.END
60-
print " "*6, "Start AppImage creation wizard"
53+
print " ", "<input AppDir>", "<output AppImage>"
54+
print " ", "Create an AppImage from an AppDir"
55+
print " ", "-f, --force"
56+
print " ", "Overwrite target if already existing"
57+
print " ", "-h, --help"
58+
print " ", "Show this help message"
59+
print " ", "<no arguments>"
60+
print " ", "Start AppImage creation wizard"
61+
exit(0)
62+
63+
64+
if len(sys.argv) == 2:
65+
usage()
6166

6267
for arg in sys.argv:
63-
if arg in ["--pack", "--package"]:
64-
if len(sys.argv) < 4:
65-
usage()
66-
elif not os.path.exists(sys.argv[2]):
67-
print sys.argv[2], "doesn't exist"
68-
elif not os.path.isdir(sys.argv[2]):
69-
print sys.argv[2], "is not a directory"
70-
elif os.path.exists(sys.argv[3]):
71-
print sys.argv[3], "already exists"
72-
else:
73-
os.system(os.path.dirname(__file__) + "/package '%s' '%s'" % (sys.argv[2], sys.argv[3]))
74-
exit(0)
75-
elif arg in ["--unpack", "--extract"]:
76-
if len(sys.argv) < 4:
77-
usage()
78-
elif not os.path.exists(sys.argv[2]):
79-
print sys.argv[2], "doesn't exist"
80-
elif not os.path.isfile(sys.argv[2]):
81-
print sys.argv[2], "is not a file"
82-
elif os.path.exists(sys.argv[3]):
83-
print sys.argv[3], "already exists"
84-
else:
85-
origin = "/"
86-
if len(sys.argv) >= 5:
87-
origin = sys.argv[4]
88-
os.system(os.path.dirname(__file__) + "/extract '%s' '%s' '%s'" % (sys.argv[2], sys.argv[3], origin))
89-
exit(0)
90-
elif arg in ["-h", "--help"]:
68+
if arg in ["-h", "--help"]:
9169
usage()
92-
exit(0)
9370

71+
if len(sys.argv) == (3):
72+
os.system(os.path.dirname(__file__) + "/package %s %s" % (sys.argv[1], sys.argv[2]))
73+
exit(0)
9474

9575
import gtk, vte
9676
import xdgappdir # bundled with this app
@@ -164,8 +144,6 @@ class Assistant(gtk.Assistant):
164144
self.set_size_request(640, 480)
165145
self.init_intro_page()
166146

167-
168-
169147
def text_page(self, header, text):
170148
label = gtk.Label(text)
171149
label.show()
@@ -304,7 +282,6 @@ class RunBox(vte.Terminal):
304282
self.connect('child-exited', self.run_command_done_callback)
305283
self.assistant = assistant # the assistant is passed in here so that we can e.g., disable forward buttons
306284

307-
308285
def run_command(self, command_list):
309286
self.assistant.set_page_complete(self.assistant.get_nth_page(self.assistant.get_current_page()), False)
310287
self.thread_running = True

AppImageAssistant.AppDir/colors.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

AppImageAssistant.AppDir/package

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ print("ok")
9595

9696
print("Making %s executable..." % (destinationfile))
9797

98-
os.chmod(destinationfile, 0o755)
98+
os.chmod(destinationfile, 0755)
9999

100100
print("ok")
101101

0 commit comments

Comments
 (0)