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

Adds --output-dir option to stubgen #3902

Merged

Conversation

Projects
None yet
2 participants
@brianbruggeman
Copy link
Contributor

commented Aug 31, 2017

Currently, the output folder is hard-coded.

  • Adds an option (--output-dir) to the stubgen command-line interface
    -- allows user to provide a different output folder other than 'out'
    -- defaults to 'out'
    -- allows ~user and relative '.' paths

  • Now creates a new folder if it doesn't already exist

@brianbruggeman brianbruggeman force-pushed the brianbruggeman:add-output-dir-option-to-stubgen branch from 51441af to 3c76fa7 Aug 31, 2017

@gvanrossum

This comment has been minimized.

Copy link
Member

commented Aug 31, 2017

The default should really remain 'out'.

@brianbruggeman

This comment has been minimized.

Copy link
Contributor Author

commented Aug 31, 2017

Is there a reason/backstory on why out is currently hard-coded?

@brianbruggeman brianbruggeman force-pushed the brianbruggeman:add-output-dir-option-to-stubgen branch 3 times, most recently from 9a2a246 to ca2576f Aug 31, 2017

@gvanrossum

This comment has been minimized.

Copy link
Member

commented Sep 1, 2017

why out is currently hard-coded?

This makes it clear what the output is from the script and makes it easy to throw it away if you prefer to start over.

args = args[1:]
# Resolve/expand output_dir; use symlinks
if output_dir.startswith('~'):
output_dir = os.path.expanduser(output_dir)

This comment has been minimized.

Copy link
@gvanrossum

gvanrossum Sep 19, 2017

Member

Normally the shell takes care of this. I think on Windows it may not -- but is it really important enough to support?

if output_dir.startswith('~'):
output_dir = os.path.expanduser(output_dir)
elif output_dir == '.':
output_dir = os.getenv('PWD') or os.getcwd()

This comment has been minimized.

Copy link
@gvanrossum

gvanrossum Sep 19, 2017

Member

What's the purpose of this? I don't believe stubgen ever changes the current directory.

This comment has been minimized.

Copy link
@brianbruggeman

brianbruggeman Sep 20, 2017

Author Contributor

These are completely unnecessary.

elif output_dir == '.':
output_dir = os.getenv('PWD') or os.getcwd()
else:
output_dir = os.path.abspath(output_dir)

This comment has been minimized.

Copy link
@gvanrossum
@@ -697,6 +712,9 @@ def parse_options(args: List[str]) -> Options:
usage()
if not interpreter:
interpreter = sys.executable if pyversion[0] == 3 else default_python2_interpreter()
# Build the output folder if it doesn't already exist.

This comment has been minimized.

Copy link
@gvanrossum

gvanrossum Sep 19, 2017

Member

Build -> Create

Adds --output-dir option to stubgen
* Adds an option (--output-dir) to the stubgen command-line interface
  -- allows user to provide a different output folder other than 'out'
  -- defaults to out
  -- allows ~user and relative '.' paths
  -- Adds help documentation and updates --output-dir to -o

@brianbruggeman brianbruggeman force-pushed the brianbruggeman:add-output-dir-option-to-stubgen branch from ca2576f to 99adac9 Sep 20, 2017

@gvanrossum gvanrossum merged commit 8b43e15 into python:master Sep 20, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@gvanrossum

This comment has been minimized.

Copy link
Member

commented Sep 20, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.