comparison makeitso/makeitso.py @ 248:407dd46857e1

fix syntax error in python.py + version bump
author Jeff Hammel <k0scist@gmail.com>
date Fri, 31 Mar 2017 18:05:28 -0700
parents fa496c9e9d73
children f10f5beb8ad1
comparison
equal deleted inserted replaced
247:43db853df1f8 248:407dd46857e1
50 url = url.rstrip('/') 50 url = url.rstrip('/')
51 for filename in files: 51 for filename in files:
52 f, headers = urllib.urlretrive('%s/%s' % (url, filename)) 52 f, headers = urllib.urlretrive('%s/%s' % (url, filename))
53 content = file(f).read() 53 content = file(f).read()
54 outfile = os.path.join(globals()['tempdir'], subdir, filename) 54 outfile = os.path.join(globals()['tempdir'], subdir, filename)
55 o = file(outfile, 'w') 55 with file(outfile, 'w') as o:
56 print >> o, content 56 o.write(content)
57 return globals()['tempdir'] 57 return globals()['tempdir']
58 58
59 tempita_files = ['__init__.py', '_looper.py', 'compat3.py'] 59 tempita_files = ['__init__.py', '_looper.py', 'compat3.py']
60 60
61 try: 61 try:
82 here = here.rstrip(os.path.sep) + os.path.sep 82 here = here.rstrip(os.path.sep) + os.path.sep
83 return here 83 return here
84 84
85 def basename(uri): 85 def basename(uri):
86 """return the basename of a URI""" 86 """return the basename of a URI"""
87
87 if '://' in uri: 88 if '://' in uri:
88 return uri.rsplit('/', 1)[1] 89 return uri.rsplit('/', 1)[1]
89 else: 90 else:
90 return os.path.basename(uri) 91 return os.path.basename(uri)
91 92
528 main() 529 main()
529 530
530 531
531 # get templates from pkg_resources 532 # get templates from pkg_resources
532 # (MakeItSo! and [TODO] pastescript templates) 533 # (MakeItSo! and [TODO] pastescript templates)
533 # this should go last to ensure the module is wholly loaded [?] 534 # this should go last to ensure the module is wholly loaded [?!]
534 def get_entry_points(): 535 def get_entry_points():
535 retval = {} 536 retval = {}
536 try: 537 try:
537 from pkg_resources import iter_entry_points 538 from pkg_resources import iter_entry_points
538 for i in iter_entry_points('makeitso.templates'): 539 for i in iter_entry_points('makeitso.templates'):