Show More
@@ -18,6 +18,7 Authors: | |||
|
18 | 18 | #----------------------------------------------------------------------------- |
|
19 | 19 | |
|
20 | 20 | import os |
|
21 | from shutil import copyfile | |
|
21 | 22 | import sys |
|
22 | 23 | from urllib import urlretrieve |
|
23 | 24 | from urlparse import urlparse |
@@ -137,8 +138,15 class ExtensionManager(Configurable): | |||
|
137 | 138 | if not os.path.isdir(self.ipython_extension_dir): |
|
138 | 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 | 148 | if filename is None: |
|
141 | filename = urlparse(url).path.split('/')[-1] | |
|
149 | filename = src_filename | |
|
142 | 150 | if os.path.splitext(filename)[1] not in ('.py', '.zip'): |
|
143 | 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