Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: revise install.py for minor improvements #36626

Merged
merged 1 commit into from
Dec 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions tools/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def abspath(*args):
return os.path.abspath(path)

def load_config():
s = open('config.gypi').read()
return ast.literal_eval(s)
with open('config.gypi') as f:
return ast.literal_eval(f.read())

def try_unlink(path):
try:
Expand Down Expand Up @@ -223,11 +223,19 @@ def run(args):
cmd = args[1] if len(args) > 1 else 'install'

if os.environ.get('HEADERS_ONLY'):
if cmd == 'install': return headers(install)
if cmd == 'uninstall': return headers(uninstall)
if cmd == 'install':
headers(install)
return
if cmd == 'uninstall':
headers(uninstall)
return
else:
if cmd == 'install': return files(install)
if cmd == 'uninstall': return files(uninstall)
if cmd == 'install':
files(install)
return
if cmd == 'uninstall':
files(uninstall)
return

raise RuntimeError('Bad command: %s\n' % cmd)

Expand Down