@@ -79,7 +79,7 @@ def add_arguments(self, parser, cli_name):
79
79
'--maintainer-email' ,
80
80
help = 'email address of the maintainer of this package' ),
81
81
parser .add_argument (
82
- '--maintainer-name' , default = getpass . getuser (),
82
+ '--maintainer-name' ,
83
83
help = 'name of the maintainer of this package' ),
84
84
parser .add_argument (
85
85
'--node-name' ,
@@ -97,13 +97,29 @@ def main(self, *, args):
97
97
print ('Supported licenses:\n %s' % ('\n ' .join (available_licenses )))
98
98
sys .exit (0 )
99
99
100
- maintainer = Person (args .maintainer_name )
100
+ git = shutil .which ('git' )
101
+
102
+ if args .maintainer_name :
103
+ maintainer_name = args .maintainer_name
104
+ else :
105
+ # try getting the name from the global git config
106
+ if git is not None :
107
+ p = subprocess .Popen (
108
+ [git , 'config' , 'user.name' ],
109
+ stdout = subprocess .PIPE )
110
+ resp = p .communicate ()
111
+ name = resp [0 ].decode ().rstrip ()
112
+ if name :
113
+ maintainer_name = name
114
+ if not maintainer_name :
115
+ maintainer_name = getpass .getuser ()
116
+
117
+ maintainer = Person (maintainer_name )
101
118
102
119
if args .maintainer_email :
103
120
maintainer .email = args .maintainer_email
104
121
else :
105
122
# try getting the email from the global git config
106
- git = shutil .which ('git' )
107
123
if git is not None :
108
124
p = subprocess .Popen (
109
125
[git , 'config' , 'user.email' ],
0 commit comments