comparison .emacs @ 513:c30cd6473984

.emacs
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 17 Sep 2013 19:24:26 -0700
parents c805a31fe0f5
children 0dbde82d1c82
comparison
equal deleted inserted replaced
512:68635bbb3d3e 513:c30cd6473984
166 166
167 if __name__ == '__main__': 167 if __name__ == '__main__':
168 main()") 168 main()")
169 ;; TODO: take directly from MakeItSo 169 ;; TODO: take directly from MakeItSo
170 170
171 (fset 'python-require "def require(url):
172 # http://k0s.org/hg/config/file/68635bbb3d3e/python/require.py
173 # import a module from the web
174 # url should be like scheme://host.name/path/to/module.py
175
176 import imp
177 import os
178 import tempfile
179 import urllib2
180 contents = urllib2.urlopen(url).read()
181 filename = url.rsplit('/', 1)[-1]
182 module = filename.rsplit('.', 1)[0]
183 dest = tempfile.mkstemp(suffix='.py', prefix=module)
184 f = file(dest, 'w')
185 f.write(contents)
186 f.close()
187 return imp.load_source(module, dest)
188 ")
189
171 (fset 'mozbase-test "#!/usr/bin/env python 190 (fset 'mozbase-test "#!/usr/bin/env python
172 191
173 # This Source Code Form is subject to the terms of the Mozilla Public 192 # This Source Code Form is subject to the terms of the Mozilla Public
174 # License, v. 2.0. If a copy of the MPL was not distributed with this file, 193 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
175 # You can obtain one at http://mozilla.org/MPL/2.0/. 194 # You can obtain one at http://mozilla.org/MPL/2.0/.