Show More
@@ -74,10 +74,6 b' from setupbase import (' | |||||
74 | check_package_data_first, |
|
74 | check_package_data_first, | |
75 | find_data_files, |
|
75 | find_data_files, | |
76 | git_prebuild, |
|
76 | git_prebuild, | |
77 | install_symlinked, |
|
|||
78 | install_lib_symlink, |
|
|||
79 | install_scripts_for_symlink, |
|
|||
80 | unsymlink, |
|
|||
81 | ) |
|
77 | ) | |
82 |
|
78 | |||
83 | #------------------------------------------------------------------------------- |
|
79 | #------------------------------------------------------------------------------- | |
@@ -135,10 +131,6 b" setup_args['cmdclass'] = {" | |||||
135 | 'build_py': \ |
|
131 | 'build_py': \ | |
136 | check_package_data_first(git_prebuild('IPython')), |
|
132 | check_package_data_first(git_prebuild('IPython')), | |
137 | 'sdist' : git_prebuild('IPython', sdist), |
|
133 | 'sdist' : git_prebuild('IPython', sdist), | |
138 | 'symlink': install_symlinked, |
|
|||
139 | 'install_lib_symlink': install_lib_symlink, |
|
|||
140 | 'install_scripts_sym': install_scripts_for_symlink, |
|
|||
141 | 'unsymlink': unsymlink, |
|
|||
142 | } |
|
134 | } | |
143 |
|
135 | |||
144 | setup_args["entry_points"] = { |
|
136 | setup_args["entry_points"] = { |
@@ -181,74 +181,10 b' def find_entry_points():' | |||||
181 | major_suffix = str(sys.version_info[0]) |
|
181 | major_suffix = str(sys.version_info[0]) | |
182 | return [e % "" for e in ep] + [e % major_suffix for e in ep] |
|
182 | return [e % "" for e in ep] + [e % major_suffix for e in ep] | |
183 |
|
183 | |||
184 |
|
||||
185 | class install_lib_symlink(Command): |
|
|||
186 | user_options = [ |
|
|||
187 | ('install-dir=', 'd', "directory to install to"), |
|
|||
188 | ] |
|
|||
189 |
|
||||
190 | def initialize_options(self): |
|
|||
191 | self.install_dir = None |
|
|||
192 |
|
||||
193 | def finalize_options(self): |
|
|||
194 | self.set_undefined_options('symlink', |
|
|||
195 | ('install_lib', 'install_dir'), |
|
|||
196 | ) |
|
|||
197 |
|
||||
198 | def run(self): |
|
|||
199 | if sys.platform == 'win32': |
|
|||
200 | raise Exception("This doesn't work on Windows.") |
|
|||
201 | pkg = os.path.join(os.getcwd(), 'IPython') |
|
|||
202 | dest = os.path.join(self.install_dir, 'IPython') |
|
|||
203 | if os.path.islink(dest): |
|
|||
204 | print('removing existing symlink at %s' % dest) |
|
|||
205 | os.unlink(dest) |
|
|||
206 | print('symlinking %s -> %s' % (pkg, dest)) |
|
|||
207 | os.symlink(pkg, dest) |
|
|||
208 |
|
||||
209 | class unsymlink(install): |
|
|||
210 | def run(self): |
|
|||
211 | dest = os.path.join(self.install_lib, 'IPython') |
|
|||
212 | if os.path.islink(dest): |
|
|||
213 | print('removing symlink at %s' % dest) |
|
|||
214 | os.unlink(dest) |
|
|||
215 | else: |
|
|||
216 | print('No symlink exists at %s' % dest) |
|
|||
217 |
|
||||
218 | class install_symlinked(install): |
|
|||
219 | def run(self): |
|
|||
220 | if sys.platform == 'win32': |
|
|||
221 | raise Exception("This doesn't work on Windows.") |
|
|||
222 |
|
||||
223 | # Run all sub-commands (at least those that need to be run) |
|
|||
224 | for cmd_name in self.get_sub_commands(): |
|
|||
225 | self.run_command(cmd_name) |
|
|||
226 |
|
||||
227 | # 'sub_commands': a list of commands this command might have to run to |
|
|||
228 | # get its work done. See cmd.py for more info. |
|
|||
229 | sub_commands = [('install_lib_symlink', lambda self:True), |
|
|||
230 | ('install_scripts_sym', lambda self:True), |
|
|||
231 | ] |
|
|||
232 |
|
||||
233 | class install_scripts_for_symlink(install_scripts): |
|
|||
234 | """Redefined to get options from 'symlink' instead of 'install'. |
|
|||
235 |
|
||||
236 | I love distutils almost as much as I love setuptools. |
|
|||
237 | """ |
|
|||
238 | def finalize_options(self): |
|
|||
239 | self.set_undefined_options('build', ('build_scripts', 'build_dir')) |
|
|||
240 | self.set_undefined_options('symlink', |
|
|||
241 | ('install_scripts', 'install_dir'), |
|
|||
242 | ('force', 'force'), |
|
|||
243 | ('skip_build', 'skip_build'), |
|
|||
244 | ) |
|
|||
245 |
|
||||
246 |
|
||||
247 | #--------------------------------------------------------------------------- |
|
184 | #--------------------------------------------------------------------------- | |
248 | # VCS related |
|
185 | # VCS related | |
249 | #--------------------------------------------------------------------------- |
|
186 | #--------------------------------------------------------------------------- | |
250 |
|
187 | |||
251 |
|
||||
252 | def git_prebuild(pkg_dir, build_cmd=build_py): |
|
188 | def git_prebuild(pkg_dir, build_cmd=build_py): | |
253 | """Return extended build or sdist command class for recording commit |
|
189 | """Return extended build or sdist command class for recording commit | |
254 |
|
190 |
General Comments 0
You need to be logged in to leave comments.
Login now