Skip to content

Commit

Permalink
Don't create pyc unless told too
Browse files Browse the repository at this point in the history
Generating pyc files is disabled unless the `write-pyc` flag is given.
This addresses #68.
  • Loading branch information
sclukey committed Sep 9, 2014
1 parent 1ea7a87 commit ea93218
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions invoke/cli.py
Expand Up @@ -145,6 +145,12 @@ def parse(argv, collection=None, version=None):
default=False,
help="Enable debug output.",
),
Argument(
names=('write-pyc',),
kind=bool,
default=False,
help="Enable creating .pyc files.",
),
))
# 'core' will result an .unparsed attribute with what was left over.
debug("Parsing initial context (core args)")
Expand All @@ -153,6 +159,10 @@ def parse(argv, collection=None, version=None):
debug("After core-args pass, leftover argv: %r" % (core.unparsed,))
args = core[0].args

# Disable creating .pyc files, unless the write-pyc flag was given.
if not args['write-pyc'].value:
sys.dont_write_bytecode = True

# Enable debugging from here on out, if debug flag was given.
if args.debug.value:
enable_logging()
Expand Down

0 comments on commit ea93218

Please sign in to comment.