-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Adds --output-dir option to stubgen #3902
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
Conversation
51441af
to
3c76fa7
Compare
The default should really remain 'out'. |
Is there a reason/backstory on why |
9a2a246
to
ca2576f
Compare
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. |
mypy/stubgen.py
Outdated
args = args[1:] | ||
# Resolve/expand output_dir; use symlinks | ||
if output_dir.startswith('~'): | ||
output_dir = os.path.expanduser(output_dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally the shell takes care of this. I think on Windows it may not -- but is it really important enough to support?
mypy/stubgen.py
Outdated
if output_dir.startswith('~'): | ||
output_dir = os.path.expanduser(output_dir) | ||
elif output_dir == '.': | ||
output_dir = os.getenv('PWD') or os.getcwd() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this? I don't believe stubgen ever changes the current directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are completely unnecessary.
mypy/stubgen.py
Outdated
elif output_dir == '.': | ||
output_dir = os.getenv('PWD') or os.getcwd() | ||
else: | ||
output_dir = os.path.abspath(output_dir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
mypy/stubgen.py
Outdated
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Build -> Create
* 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
ca2576f
to
99adac9
Compare
Thanks! |
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