Go to the documentation of this file.00001
00002
00003
00004
00005 def author_name():
00006 """
00007 Utility to compute logged in user name
00008
00009 :returns: name of current user, ``str``
00010 """
00011 import getpass
00012 name = getpass.getuser()
00013 try:
00014 import pwd
00015 login = name
00016 name = pwd.getpwnam(login)[4]
00017 name = ''.join(name.split(','))
00018
00019 if not name:
00020 name = login
00021 except:
00022
00023 pass
00024 if type(name) == str:
00025 name = name.decode('utf-8')
00026 return name
00027
00028
00029 def read_template(tmplf):
00030 f = open(tmplf, 'r')
00031 try:
00032 t = f.read()
00033 finally:
00034 f.close()
00035 return t
00036
00037
00038
00039 def instantiate_template(template, package, description, author, depends):
00040 return template%locals()