Mercurial > hg > easyhg
comparison easyhg.py @ 503:1e735168df81
Encountering some peculiar problems with platform... but it's overkill for this anyway, use os.name instead
author | Chris Cannam |
---|---|
date | Thu, 15 Sep 2011 14:24:37 +0100 |
parents | 0714a86b8077 |
children | 533519ebc0cb |
comparison
equal
deleted
inserted
replaced
502:ba924fc4790a | 503:1e735168df81 |
---|---|
11 # modify it under the terms of the GNU General Public License as | 11 # modify it under the terms of the GNU General Public License as |
12 # published by the Free Software Foundation; either version 2 of the | 12 # published by the Free Software Foundation; either version 2 of the |
13 # License, or (at your option) any later version. See the file | 13 # License, or (at your option) any later version. See the file |
14 # COPYING included with this distribution for more information. | 14 # COPYING included with this distribution for more information. |
15 | 15 |
16 import sys, os, stat, urllib, urllib2, urlparse, platform, hashlib | 16 import sys, os, stat, urllib, urllib2, urlparse, hashlib |
17 | 17 |
18 from mercurial.i18n import _ | 18 from mercurial.i18n import _ |
19 from mercurial import ui, util, error | 19 from mercurial import ui, util, error |
20 try: | 20 try: |
21 from mercurial.url import passwordmgr | 21 from mercurial.url import passwordmgr |
133 try: | 133 try: |
134 ofp = open(self.auth_file, 'w') | 134 ofp = open(self.auth_file, 'w') |
135 except: | 135 except: |
136 self.ui.write("failed to open authfile %s for writing\n" % self.auth_file) | 136 self.ui.write("failed to open authfile %s for writing\n" % self.auth_file) |
137 raise | 137 raise |
138 if platform.system() != 'Windows': | 138 if os.name == 'posix': |
139 try: | 139 try: |
140 os.fchmod(ofp.fileno(), stat.S_IRUSR | stat.S_IWUSR) | 140 os.fchmod(ofp.fileno(), stat.S_IRUSR | stat.S_IWUSR) |
141 except: | 141 except: |
142 ofp.close() | 142 ofp.close() |
143 self.ui.write("failed to set permissions on authfile %s\n" % self.auth_file) | 143 self.ui.write("failed to set permissions on authfile %s\n" % self.auth_file) |