-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Optionally skip creation of .gitignore in virtualenv directory #2004
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
Changes from 3 commits
43d27d7
8025d4e
1a28968
6e13306
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Optionally skip VCS ignore directive for entire virtualenv directory, using option :option:`no-vcs-ignore`, by default ``False``. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,7 @@ def __init__(self, options, interpreter): | |
| self._debug = None | ||
| self.dest = Path(options.dest) | ||
| self.clear = options.clear | ||
| self.vcs_ignore = options.vcs_ignore | ||
| self.pyenv_cfg = PyEnvCfg.from_folder(self.dest) | ||
| self.app_data = options.app_data | ||
|
|
||
|
|
@@ -57,6 +58,7 @@ def _args(self): | |
| return [ | ||
| ("dest", ensure_text(str(self.dest))), | ||
| ("clear", self.clear), | ||
| ("vcs_ignore", self.vcs_ignore), | ||
| ] | ||
|
|
||
| @classmethod | ||
|
|
@@ -90,6 +92,13 @@ def add_parser_arguments(cls, parser, interpreter, meta, app_data): | |
| help="remove the destination directory if exist before starting (will overwrite files otherwise)", | ||
| default=False, | ||
| ) | ||
| parser.add_argument( | ||
| "--no-vcs-ignore", | ||
| dest="vcs_ignore", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like how you negated the flag name, but kept the destination positive. Please keep them in sync. This flag should be
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. Wasn't really any reason for old way, other than the double negative on line 172, and "because I can". But bringing into sync also will make the default value in auto-docs less confusing (actually correct). |
||
| action="store_false", | ||
| help="don't create VCS ignore directive in the destination directory", | ||
| default=True, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this break convention and more importantly the CLI option-environment variable interop, by renaming the argument? I wasn't aware of the config-file/env-var pathway to set these, and now it's not clear to me if those will expect a value at
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So if you put: in your users
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perfect |
||
| ) | ||
|
|
||
| @abstractmethod | ||
| def create(self): | ||
|
|
@@ -160,7 +169,8 @@ def run(self): | |
| safe_delete(self.dest) | ||
| self.create() | ||
| self.set_pyenv_cfg() | ||
| self.setup_ignore_vcs() | ||
|
compwiztobe marked this conversation as resolved.
|
||
| if self.vcs_ignore: | ||
| self.setup_ignore_vcs() | ||
|
|
||
| def set_pyenv_cfg(self): | ||
| self.pyenv_cfg.content = OrderedDict() | ||
|
|
||
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.
VIRTUALENV_NO_VCS_IGNOREandno_vcs_ignorewill be the names as documented under https://virtualenv.pypa.io/en/latest/cli_interface.html#environment-variables. The destination variable doesn't matter only the CLI flag.