Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: native_client_sdk/src/build_tools/dsc2gyp.py

Issue 720233003: [NaCl SDK] Convert python scripts from optparse to argparse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « native_client_sdk/src/build_tools/buildbot_run.py ('k') | native_client_sdk/src/build_tools/dsc_info.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/src/build_tools/dsc2gyp.py
diff --git a/native_client_sdk/src/build_tools/dsc2gyp.py b/native_client_sdk/src/build_tools/dsc2gyp.py
index f0ecfa3590ab2548a7c7a77f5c6f6a5c2d079639..7032e94c0631d84d167f51e9e63be25507bbbec1 100755
--- a/native_client_sdk/src/build_tools/dsc2gyp.py
+++ b/native_client_sdk/src/build_tools/dsc2gyp.py
@@ -2,10 +2,11 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+
+import argparse
import StringIO
import sys
import os
-import optparse
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(os.path.dirname(SCRIPT_DIR), 'tools'))
@@ -359,19 +360,17 @@ def ProcessDSC(filename, outfile=None):
def main(args):
- parser = optparse.OptionParser()
- parser.add_option('-o', help='Set output filename.', dest='output')
- options, args = parser.parse_args(args)
- if not args:
- Error('No .dsc file specified.')
+ parser = argparse.ArgumentParser()
+ parser.add_argument('-o', help='Set output filename.', dest='output')
+ parser.add_argument('dsc', help='dsc to convert')
+ options = parser.parse_args(args)
if options.output:
outdir = os.path.dirname(options.output)
if not os.path.exists(outdir):
os.makedirs(outdir)
- assert len(args) == 1
- ProcessDSC(args[0], options.output)
+ ProcessDSC(options.dsc, options.output)
return 0
« no previous file with comments | « native_client_sdk/src/build_tools/buildbot_run.py ('k') | native_client_sdk/src/build_tools/dsc_info.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698