Mercurial > cpython-lru_cache-weakref
annotate Mac/PythonLauncher/FileSettings.m @ 84479:738cba2bf849 3.3
Issue #18377: Code cleanup in Python Launcher
This changeset fixes a number of compiler warnings in the Python Launcher
binary for OSX. It also cleans up whitespace usage in those sources.
| author | Ronald Oussoren <ronaldoussoren@mac.com> |
|---|---|
| date | Sun, 07 Jul 2013 09:53:08 +0200 |
| parents | 39523461ef7e |
| children |
| rev | line source |
|---|---|
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
1 // |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
2 // FileSettings.m |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
3 // PythonLauncher |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
4 // |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
5 // Created by Jack Jansen on Sun Jul 21 2002. |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
6 // Copyright (c) 2002 __MyCompanyName__. All rights reserved. |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
7 // |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
8 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
9 #import "FileSettings.h" |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
10 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
11 @implementation FileSettings |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
12 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
13 + (id)getFactorySettingsForFileType: (NSString *)filetype |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
14 { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
15 static FileSettings *fsdefault_py, *fsdefault_pyw, *fsdefault_pyc; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
16 FileSettings **curdefault; |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
17 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
18 if ([filetype isEqualToString: @"Python Script"]) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
19 curdefault = &fsdefault_py; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
20 } else if ([filetype isEqualToString: @"Python GUI Script"]) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
21 curdefault = &fsdefault_pyw; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
22 } else if ([filetype isEqualToString: @"Python Bytecode Document"]) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
23 curdefault = &fsdefault_pyc; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
24 } else { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
25 NSLog(@"Funny File Type: %@\n", filetype); |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
26 curdefault = &fsdefault_py; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
27 filetype = @"Python Script"; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
28 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
29 if (!*curdefault) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
30 *curdefault = [[FileSettings new] initForFSDefaultFileType: filetype]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
31 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
32 return *curdefault; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
33 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
34 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
35 + (id)getDefaultsForFileType: (NSString *)filetype |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
36 { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
37 static FileSettings *default_py, *default_pyw, *default_pyc; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
38 FileSettings **curdefault; |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
39 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
40 if ([filetype isEqualToString: @"Python Script"]) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
41 curdefault = &default_py; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
42 } else if ([filetype isEqualToString: @"Python GUI Script"]) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
43 curdefault = &default_pyw; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
44 } else if ([filetype isEqualToString: @"Python Bytecode Document"]) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
45 curdefault = &default_pyc; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
46 } else { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
47 NSLog(@"Funny File Type: %@\n", filetype); |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
48 curdefault = &default_py; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
49 filetype = @"Python Script"; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
50 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
51 if (!*curdefault) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
52 *curdefault = [[FileSettings new] initForDefaultFileType: filetype]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
53 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
54 return *curdefault; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
55 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
56 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
57 + (id)newSettingsForFileType: (NSString *)filetype |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
58 { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
59 FileSettings *cur; |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
60 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
61 cur = [FileSettings new]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
62 [cur initForFileType: filetype]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
63 return [cur retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
64 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
65 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
66 - (id)initWithFileSettings: (FileSettings *)source |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
67 { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
68 self = [super init]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
69 if (!self) return self; |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
70 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
71 interpreter = [source->interpreter retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
72 honourhashbang = source->honourhashbang; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
73 debug = source->debug; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
74 verbose = source->verbose; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
75 inspect = source->inspect; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
76 optimize = source->optimize; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
77 nosite = source->nosite; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
78 tabs = source->tabs; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
79 others = [source->others retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
80 scriptargs = [source->scriptargs retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
81 with_terminal = source->with_terminal; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
82 prefskey = source->prefskey; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
83 if (prefskey) [prefskey retain]; |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
84 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
85 return self; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
86 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
87 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
88 - (id)initForFileType: (NSString *)filetype |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
89 { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
90 FileSettings *defaults; |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
91 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
92 defaults = [FileSettings getDefaultsForFileType: filetype]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
93 self = [self initWithFileSettings: defaults]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
94 origsource = [defaults retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
95 return self; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
96 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
97 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
98 - (id)initForFSDefaultFileType: (NSString *)filetype |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
99 { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
100 int i; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
101 NSString *filename; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
102 NSDictionary *dict; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
103 static NSDictionary *factorySettings; |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
104 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
105 self = [super init]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
106 if (!self) return self; |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
107 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
108 if (factorySettings == NULL) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
109 NSBundle *bdl = [NSBundle mainBundle]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
110 NSString *path = [ bdl pathForResource: @"factorySettings" |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
111 ofType: @"plist"]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
112 factorySettings = [[NSDictionary dictionaryWithContentsOfFile: |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
113 path] retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
114 if (factorySettings == NULL) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
115 NSLog(@"Missing %@", path); |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
116 return NULL; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
117 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
118 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
119 dict = [factorySettings objectForKey: filetype]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
120 if (dict == NULL) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
121 NSLog(@"factorySettings.plist misses file type \"%@\"", filetype); |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
122 interpreter = [@"no default found" retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
123 return NULL; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
124 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
125 [self applyValuesFromDict: dict]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
126 interpreters = [dict objectForKey: @"interpreter_list"]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
127 interpreter = NULL; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
128 for (i=0; i < [interpreters count]; i++) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
129 filename = [interpreters objectAtIndex: i]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
130 filename = [filename stringByExpandingTildeInPath]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
131 if ([[NSFileManager defaultManager] fileExistsAtPath: filename]) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
132 interpreter = [filename retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
133 break; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
134 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
135 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
136 if (interpreter == NULL) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
137 interpreter = [@"no default found" retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
138 origsource = NULL; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
139 return self; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
140 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
141 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
142 - (void)applyUserDefaults: (NSString *)filetype |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
143 { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
144 NSUserDefaults *defaults; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
145 NSDictionary *dict; |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
146 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
147 defaults = [NSUserDefaults standardUserDefaults]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
148 dict = [defaults dictionaryForKey: filetype]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
149 if (!dict) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
150 return; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
151 [self applyValuesFromDict: dict]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
152 } |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
153 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
154 - (id)initForDefaultFileType: (NSString *)filetype |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
155 { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
156 FileSettings *fsdefaults; |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
157 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
158 fsdefaults = [FileSettings getFactorySettingsForFileType: filetype]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
159 self = [self initWithFileSettings: fsdefaults]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
160 if (!self) return self; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
161 interpreters = [fsdefaults->interpreters retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
162 scriptargs = [@"" retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
163 [self applyUserDefaults: filetype]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
164 prefskey = [filetype retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
165 return self; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
166 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
167 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
168 - (void)reset |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
169 { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
170 if (origsource) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
171 [self updateFromSource: origsource]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
172 } else { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
173 FileSettings *fsdefaults; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
174 fsdefaults = [FileSettings getFactorySettingsForFileType: prefskey]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
175 [self updateFromSource: fsdefaults]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
176 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
177 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
178 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
179 - (void)updateFromSource: (id <FileSettingsSource>)source |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
180 { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
181 interpreter = [[source interpreter] retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
182 honourhashbang = [source honourhashbang]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
183 debug = [source debug]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
184 verbose = [source verbose]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
185 inspect = [source inspect]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
186 optimize = [source optimize]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
187 nosite = [source nosite]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
188 tabs = [source tabs]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
189 others = [[source others] retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
190 scriptargs = [[source scriptargs] retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
191 with_terminal = [source with_terminal]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
192 // And if this is a user defaults object we also save the |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
193 // values |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
194 if (!origsource) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
195 NSUserDefaults *defaults; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
196 NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
197 interpreter, @"interpreter", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
198 [NSNumber numberWithBool: honourhashbang], @"honourhashbang", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
199 [NSNumber numberWithBool: debug], @"debug", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
200 [NSNumber numberWithBool: verbose], @"verbose", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
201 [NSNumber numberWithBool: inspect], @"inspect", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
202 [NSNumber numberWithBool: optimize], @"optimize", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
203 [NSNumber numberWithBool: nosite], @"nosite", |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39442
diff
changeset
|
204 [NSNumber numberWithBool: tabs], @"tabs", |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
205 others, @"others", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
206 scriptargs, @"scriptargs", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
207 [NSNumber numberWithBool: with_terminal], @"with_terminal", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
208 nil]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
209 defaults = [NSUserDefaults standardUserDefaults]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
210 [defaults setObject: dict forKey: prefskey]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
211 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
212 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
213 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
214 - (void)applyValuesFromDict: (NSDictionary *)dict |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
215 { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
216 id value; |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
217 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
218 value = [dict objectForKey: @"interpreter"]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
219 if (value) interpreter = [value retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
220 value = [dict objectForKey: @"honourhashbang"]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
221 if (value) honourhashbang = [value boolValue]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
222 value = [dict objectForKey: @"debug"]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
223 if (value) debug = [value boolValue]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
224 value = [dict objectForKey: @"verbose"]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
225 if (value) verbose = [value boolValue]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
226 value = [dict objectForKey: @"inspect"]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
227 if (value) inspect = [value boolValue]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
228 value = [dict objectForKey: @"optimize"]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
229 if (value) optimize = [value boolValue]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
230 value = [dict objectForKey: @"nosite"]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
231 if (value) nosite = [value boolValue]; |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39442
diff
changeset
|
232 value = [dict objectForKey: @"tabs"]; |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
233 if (value) tabs = [value boolValue]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
234 value = [dict objectForKey: @"others"]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
235 if (value) others = [value retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
236 value = [dict objectForKey: @"scriptargs"]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
237 if (value) scriptargs = [value retain]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
238 value = [dict objectForKey: @"with_terminal"]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
239 if (value) with_terminal = [value boolValue]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
240 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
241 |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
242 - (NSString*)_replaceSingleQuotes: (NSString*)string |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
243 { |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
244 /* Replace all single-quotes by '"'"', that way shellquoting will |
|
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
245 * be correct when the result value is delimited using single quotes. |
|
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
246 */ |
|
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
247 NSArray* components = [string componentsSeparatedByString:@"'"]; |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
248 |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
249 return [components componentsJoinedByString:@"'\"'\"'"]; |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
250 } |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
251 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
252 - (NSString *)commandLineForScript: (NSString *)script |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
253 { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
254 NSString *cur_interp = NULL; |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
255 NSString* script_dir = NULL; |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
256 char hashbangbuf[1024]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
257 FILE *fp; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
258 char *p; |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
259 |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
260 script_dir = [script substringToIndex: |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
261 [script length]-[[script lastPathComponent] length]]; |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
262 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
263 if (honourhashbang && |
|
52458
39523461ef7e
Merged revisions 70735 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
40450
diff
changeset
|
264 (fp=fopen([script fileSystemRepresentation], "r")) && |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
265 fgets(hashbangbuf, sizeof(hashbangbuf), fp) && |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
266 strncmp(hashbangbuf, "#!", 2) == 0 && |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
267 (p=strchr(hashbangbuf, '\n'))) { |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
268 *p = '\0'; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
269 p = hashbangbuf + 2; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
270 while (*p == ' ') p++; |
|
52458
39523461ef7e
Merged revisions 70735 via svnmerge from
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
40450
diff
changeset
|
271 cur_interp = [NSString stringWithUTF8String: p]; |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
272 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
273 if (!cur_interp) |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
274 cur_interp = interpreter; |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
275 |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
276 return [NSString stringWithFormat: |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
277 @"cd '%@' && '%@'%s%s%s%s%s%s %@ '%@' %@ %s", |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
278 [self _replaceSingleQuotes:script_dir], |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
279 [self _replaceSingleQuotes:cur_interp], |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
280 debug?" -d":"", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
281 verbose?" -v":"", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
282 inspect?" -i":"", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
283 optimize?" -O":"", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
284 nosite?" -S":"", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
285 tabs?" -t":"", |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
286 others, |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38673
diff
changeset
|
287 [self _replaceSingleQuotes:script], |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39442
diff
changeset
|
288 scriptargs ? scriptargs : @"", |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
289 with_terminal? "&& echo Exit status: $? && exit 1" : " &"]; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
290 } |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
291 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
292 - (NSArray *) interpreters { return interpreters;}; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
293 |
|
84479
738cba2bf849
Issue #18377: Code cleanup in Python Launcher
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
52458
diff
changeset
|
294 // FileSettingsSource protocol |
|
38673
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
295 - (NSString *) interpreter { return interpreter;}; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
296 - (BOOL) honourhashbang { return honourhashbang; }; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
297 - (BOOL) debug { return debug;}; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
298 - (BOOL) verbose { return verbose;}; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
299 - (BOOL) inspect { return inspect;}; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
300 - (BOOL) optimize { return optimize;}; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
301 - (BOOL) nosite { return nosite;}; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
302 - (BOOL) tabs { return tabs;}; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
303 - (NSString *) others { return others;}; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
304 - (NSString *) scriptargs { return scriptargs;}; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
305 - (BOOL) with_terminal { return with_terminal;}; |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
306 |
|
a19c20c5e5c7
Merge the rest of the trunk.
Thomas Wouters <thomas@python.org>
parents:
diff
changeset
|
307 @end |
