2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
13 if __name__
== '__main__':
15 if len(sys
.argv
) > 1 and sys
.argv
[1].endswith('appcfg.py'):
16 appcfg_path
= sys
.argv
[1]
17 additional_args
= sys
.argv
[2:]
20 additional_args
= sys
.argv
[1:]
22 os
.path
.join(os
.environ
['HOME'], 'local', 'google_appengine'),
23 os
.path
.join(os
.environ
['HOME'], 'google_appengine'),
24 os
.getcwd()] + sys
.path
:
25 full_path
= os
.path
.join(path
, 'appcfg.py')
26 if os
.path
.exists(full_path
):
27 appcfg_path
= full_path
29 if appcfg_path
is None:
30 print 'appcfg.py could not be found in default paths.'
31 print 'usage: update_server.py <path_to_appcfg.py> <appcfg_options>'
35 server2_path
= os
.path
.dirname(sys
.argv
[0])
36 subprocess
.call([appcfg_path
, 'update', server2_path
] + additional_args
)
40 'Update github username/password (empty to skip)? ')
42 password
= getpass
.getpass()
43 with
open('github_file_system.py') as f
:
45 if 'USERNAME = None' not in contents
:
46 print 'Error: Can\'t find "USERNAME = None" in github_file_system.py.'
48 if 'PASSWORD = None' not in contents
:
49 print 'Error: Can\'t find "PASSWORD = None" in github_file_system.py.'
52 with
open('github_file_system.py', 'w+') as f
:
54 contents
.replace('PASSWORD = None', 'PASSWORD = \'%s\'' % password
)
55 .replace('USERNAME = None', 'USERNAME = \'%s\'' % username
))
58 with
open('github_file_system.py', 'w+') as f
: