Show More
@@ -18,6 +18,7 b' Authors:' | |||||
18 | #----------------------------------------------------------------------------- |
|
18 | #----------------------------------------------------------------------------- | |
19 |
|
19 | |||
20 | import os |
|
20 | import os | |
|
21 | from shutil import copyfile | |||
21 | import sys |
|
22 | import sys | |
22 | from urllib import urlretrieve |
|
23 | from urllib import urlretrieve | |
23 | from urlparse import urlparse |
|
24 | from urlparse import urlparse | |
@@ -137,8 +138,15 b' class ExtensionManager(Configurable):' | |||||
137 | if not os.path.isdir(self.ipython_extension_dir): |
|
138 | if not os.path.isdir(self.ipython_extension_dir): | |
138 | os.makedirs(self.ipython_extension_dir, mode = 0777) |
|
139 | os.makedirs(self.ipython_extension_dir, mode = 0777) | |
139 |
|
140 | |||
|
141 | if os.path.isfile(url): | |||
|
142 | src_filename = os.path.basename(url) | |||
|
143 | copy = copyfile | |||
|
144 | else: | |||
|
145 | src_filename = urlparse(url).path.split('/')[-1] | |||
|
146 | copy = urlretrieve | |||
|
147 | ||||
140 | if filename is None: |
|
148 | if filename is None: | |
141 | filename = urlparse(url).path.split('/')[-1] |
|
149 | filename = src_filename | |
142 | if os.path.splitext(filename)[1] not in ('.py', '.zip'): |
|
150 | if os.path.splitext(filename)[1] not in ('.py', '.zip'): | |
143 | raise ValueError("The file must have a .py or .zip extension", filename) |
|
151 | raise ValueError("The file must have a .py or .zip extension", filename) | |
144 |
|
152 |
General Comments 0
You need to be logged in to leave comments.
Login now