Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Mac/PythonLauncher/FileSettings.m

    r2 r391  
    1515    static FileSettings *fsdefault_py, *fsdefault_pyw, *fsdefault_pyc;
    1616    FileSettings **curdefault;
    17    
     17
    1818    if ([filetype isEqualToString: @"Python Script"]) {
    1919        curdefault = &fsdefault_py;
     
    3737    static FileSettings *default_py, *default_pyw, *default_pyc;
    3838    FileSettings **curdefault;
    39    
     39
    4040    if ([filetype isEqualToString: @"Python Script"]) {
    4141        curdefault = &default_py;
     
    5858{
    5959    FileSettings *cur;
    60    
     60
    6161    cur = [FileSettings new];
    6262    [cur initForFileType: filetype];
     
    6868    self = [super init];
    6969    if (!self) return self;
    70    
     70
    7171    interpreter = [source->interpreter retain];
    7272    honourhashbang = source->honourhashbang;
     
    8282    prefskey = source->prefskey;
    8383    if (prefskey) [prefskey retain];
    84    
     84
    8585    return self;
    8686}
     
    8989{
    9090    FileSettings *defaults;
    91    
     91
    9292    defaults = [FileSettings getDefaultsForFileType: filetype];
    9393    self = [self initWithFileSettings: defaults];
     
    9696}
    9797
    98 //- (id)init
    99 //{
    100 //    self = [self initForFileType: @"Python Script"];
    101 //    return self;
    102 //}
    103 
    10498- (id)initForFSDefaultFileType: (NSString *)filetype
    10599{
     
    108102    NSDictionary *dict;
    109103    static NSDictionary *factorySettings;
    110    
     104
    111105    self = [super init];
    112106    if (!self) return self;
    113    
     107
    114108    if (factorySettings == NULL) {
    115109        NSBundle *bdl = [NSBundle mainBundle];
     
    150144    NSUserDefaults *defaults;
    151145    NSDictionary *dict;
    152    
     146
    153147    defaults = [NSUserDefaults standardUserDefaults];
    154148    dict = [defaults dictionaryForKey: filetype];
     
    157151    [self applyValuesFromDict: dict];
    158152}
    159    
     153
    160154- (id)initForDefaultFileType: (NSString *)filetype
    161155{
    162156    FileSettings *fsdefaults;
    163    
     157
    164158    fsdefaults = [FileSettings getFactorySettingsForFileType: filetype];
    165159    self = [self initWithFileSettings: fsdefaults];
     
    221215{
    222216    id value;
    223    
     217
    224218    value = [dict objectForKey: @"interpreter"];
    225219    if (value) interpreter = [value retain];
     
    248242- (NSString*)_replaceSingleQuotes: (NSString*)string
    249243{
    250         /* Replace all single-quotes by '"'"', that way shellquoting will
    251         * be correct when the result value is delimited  using single quotes.
    252         */
    253         NSArray* components = [string componentsSeparatedByString:@"'"];
    254 
    255         return [components componentsJoinedByString:@"'\"'\"'"];
     244    /* Replace all single-quotes by '"'"', that way shellquoting will
     245    * be correct when the result value is delimited  using single quotes.
     246    */
     247    NSArray* components = [string componentsSeparatedByString:@"'"];
     248
     249    return [components componentsJoinedByString:@"'\"'\"'"];
    256250}
    257251
     
    266260    script_dir = [script substringToIndex:
    267261            [script length]-[[script lastPathComponent] length]];
    268    
     262
    269263    if (honourhashbang &&
    270        (fp=fopen([script cString], "r")) &&
     264       (fp=fopen([script fileSystemRepresentation], "r")) &&
    271265       fgets(hashbangbuf, sizeof(hashbangbuf), fp) &&
    272266       strncmp(hashbangbuf, "#!", 2) == 0 &&
     
    275269            p = hashbangbuf + 2;
    276270            while (*p == ' ') p++;
    277             cur_interp = [NSString stringWithCString: p];
     271            cur_interp = [NSString stringWithUTF8String: p];
    278272    }
    279273    if (!cur_interp)
    280274        cur_interp = interpreter;
    281        
     275
    282276    return [NSString stringWithFormat:
    283277        @"cd '%@' && '%@'%s%s%s%s%s%s %@ '%@' %@ %s",
     
    298292- (NSArray *) interpreters { return interpreters;};
    299293
    300 // FileSettingsSource protocol 
     294// FileSettingsSource protocol
    301295- (NSString *) interpreter { return interpreter;};
    302296- (BOOL) honourhashbang { return honourhashbang; };
Note: See TracChangeset for help on using the changeset viewer.