summaryrefslogtreecommitdiff
path: root/src/virtualenv/create/via_global_ref/api.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/virtualenv/create/via_global_ref/api.py')
-rw-r--r--src/virtualenv/create/via_global_ref/api.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/virtualenv/create/via_global_ref/api.py b/src/virtualenv/create/via_global_ref/api.py
index 6f296f4..7a4086f 100644
--- a/src/virtualenv/create/via_global_ref/api.py
+++ b/src/virtualenv/create/via_global_ref/api.py
@@ -1,21 +1,16 @@
-from __future__ import absolute_import, unicode_literals
-
import logging
import os
from abc import ABCMeta
-
-from six import add_metaclass
+from pathlib import Path
from virtualenv.info import fs_supports_symlink
-from virtualenv.util.path import Path
-from virtualenv.util.six import ensure_text
from ..creator import Creator, CreatorMeta
class ViaGlobalRefMeta(CreatorMeta):
def __init__(self):
- super(ViaGlobalRefMeta, self).__init__()
+ super().__init__()
self.copy_error = None
self.symlink_error = None
if not fs_supports_symlink():
@@ -30,10 +25,9 @@ class ViaGlobalRefMeta(CreatorMeta):
return not self.symlink_error
-@add_metaclass(ABCMeta)
-class ViaGlobalRefApi(Creator):
+class ViaGlobalRefApi(Creator, metaclass=ABCMeta):
def __init__(self, options, interpreter):
- super(ViaGlobalRefApi, self).__init__(options, interpreter)
+ super().__init__(options, interpreter)
self.symlinks = self._should_symlink(options)
self.enable_system_site_package = options.system_site
@@ -56,7 +50,7 @@ class ViaGlobalRefApi(Creator):
@classmethod
def add_parser_arguments(cls, parser, interpreter, meta, app_data):
- super(ViaGlobalRefApi, cls).add_parser_arguments(parser, interpreter, meta, app_data)
+ super().add_parser_arguments(parser, interpreter, meta, app_data)
parser.add_argument(
"--system-site-packages",
default=False,
@@ -92,10 +86,10 @@ class ViaGlobalRefApi(Creator):
text = self.env_patch_text()
if text:
pth = self.purelib / "_virtualenv.pth"
- logging.debug("create virtualenv import hook file %s", ensure_text(str(pth)))
+ logging.debug("create virtualenv import hook file %s", pth)
pth.write_text("import _virtualenv")
dest_path = self.purelib / "_virtualenv.py"
- logging.debug("create %s", ensure_text(str(dest_path)))
+ logging.debug("create %s", dest_path)
dest_path.write_text(text)
def env_patch_text(self):
@@ -105,8 +99,14 @@ class ViaGlobalRefApi(Creator):
return text.replace('"__SCRIPT_DIR__"', repr(os.path.relpath(str(self.script_dir), str(self.purelib))))
def _args(self):
- return super(ViaGlobalRefApi, self)._args() + [("global", self.enable_system_site_package)]
+ return super()._args() + [("global", self.enable_system_site_package)]
def set_pyenv_cfg(self):
- super(ViaGlobalRefApi, self).set_pyenv_cfg()
+ super().set_pyenv_cfg()
self.pyenv_cfg["include-system-site-packages"] = "true" if self.enable_system_site_package else "false"
+
+
+__all__ = [
+ "ViaGlobalRefMeta",
+ "ViaGlobalRefApi",
+]