diff options
| author | Seungmin Ryu <yakkle@gmail.com> | 2020-02-26 17:17:01 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-26 08:17:01 +0000 |
| commit | c3453b6c381d28377c8e0115bf1124b2ca7b3c2b (patch) | |
| tree | a0fba9154991f4d4c6d89158a97550e02b8de64f /src/virtualenv/run/plugin | |
| parent | 45d2802651cda42f3202945fee73835253782b4e (diff) | |
| download | virtualenv-c3453b6c381d28377c8e0115bf1124b2ca7b3c2b.tar.gz | |
handle application data folder is read only (#1661)
* fixed FileNotFoundError when directory isn't writable (#1640)
- when using docker, if `user_data_dir()` isn't writable directory,
`default_data_dir()` use `system temp directory` + `virtualenv`.
for example, tempdir is `/tmp`, it use `/tmp/virtualenv`
* start making the app-data more explicit and robust
Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
* fix Windows
* fix docs
Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
Co-authored-by: Bernát Gábor <gaborjbernat@gmail.com>
Diffstat (limited to 'src/virtualenv/run/plugin')
| -rw-r--r-- | src/virtualenv/run/plugin/activators.py | 2 | ||||
| -rw-r--r-- | src/virtualenv/run/plugin/base.py | 6 | ||||
| -rw-r--r-- | src/virtualenv/run/plugin/creators.py | 4 | ||||
| -rw-r--r-- | src/virtualenv/run/plugin/discovery.py | 6 |
4 files changed, 12 insertions, 6 deletions
diff --git a/src/virtualenv/run/plugin/activators.py b/src/virtualenv/run/plugin/activators.py index 69b3050..dea2827 100644 --- a/src/virtualenv/run/plugin/activators.py +++ b/src/virtualenv/run/plugin/activators.py @@ -21,7 +21,7 @@ class ActivationSelector(ComponentBuilder): self.parser.add_argument( "--{}".format(name), default=self.default, - metavar="comma_separated_list", + metavar="comma_sep_list", required=False, help="activators to generate - default is all supported", type=self._extract_activators, diff --git a/src/virtualenv/run/plugin/base.py b/src/virtualenv/run/plugin/base.py index 8aa4206..ed10fe0 100644 --- a/src/virtualenv/run/plugin/base.py +++ b/src/virtualenv/run/plugin/base.py @@ -47,12 +47,12 @@ class ComponentBuilder(PluginLoader): if selected not in self.possible: raise RuntimeError("No implementation for {}".format(self.interpreter)) self._impl_class = self.possible[selected] - self.populate_selected_argparse(selected) + self.populate_selected_argparse(selected, options.app_data) return selected - def populate_selected_argparse(self, selected): + def populate_selected_argparse(self, selected, app_data): self.parser.description = "options for {} {}".format(self.name, selected) - self._impl_class.add_parser_arguments(self.parser, self.interpreter) + self._impl_class.add_parser_arguments(self.parser, self.interpreter, app_data) def create(self, options): return self._impl_class(options, self.interpreter) diff --git a/src/virtualenv/run/plugin/creators.py b/src/virtualenv/run/plugin/creators.py index 7c8132d..cbf0a5d 100644 --- a/src/virtualenv/run/plugin/creators.py +++ b/src/virtualenv/run/plugin/creators.py @@ -55,9 +55,9 @@ class CreatorSelector(ComponentBuilder): def _get_default(choices): return next(iter(choices)) - def populate_selected_argparse(self, selected): + def populate_selected_argparse(self, selected, app_data): self.parser.description = "options for {} {}".format(self.name, selected) - self._impl_class.add_parser_arguments(self.parser, self.interpreter, self.key_to_meta[selected]) + self._impl_class.add_parser_arguments(self.parser, self.interpreter, self.key_to_meta[selected], app_data) def create(self, options): options.meta = self.key_to_meta[getattr(options, self.name)] diff --git a/src/virtualenv/run/plugin/discovery.py b/src/virtualenv/run/plugin/discovery.py index 8890150..43d5eb2 100644 --- a/src/virtualenv/run/plugin/discovery.py +++ b/src/virtualenv/run/plugin/discovery.py @@ -1,5 +1,7 @@ from __future__ import absolute_import, unicode_literals +from virtualenv.run.app_data import TempAppData + from .base import PluginLoader @@ -20,6 +22,10 @@ def get_discover(parser, args, options): help="interpreter discovery method", ) options, _ = parser.parse_known_args(args, namespace=options) + if options.app_data == "<temp folder>": + options.app_data = TempAppData() + if options.clear_app_data: + options.app_data.clean() discover_class = discover_types[options.discovery] discover_class.add_parser_arguments(discovery_parser) options, _ = parser.parse_known_args(args, namespace=options) |
