mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
enable pywin32 for Python3.10, make it an optional dependency (#6841)
This commit is contained in:
+3
-3
@@ -48,17 +48,17 @@ def _spawn_posix(cmd, env):
|
|||||||
# with PyInstaller has trouble with SystemExit exception and throws
|
# with PyInstaller has trouble with SystemExit exception and throws
|
||||||
# errors such as "[26338] Failed to execute script __main__"
|
# errors such as "[26338] Failed to execute script __main__"
|
||||||
try:
|
try:
|
||||||
pid = os.fork()
|
pid = os.fork() # pylint: disable=no-member
|
||||||
if pid > 0:
|
if pid > 0:
|
||||||
return
|
return
|
||||||
except OSError:
|
except OSError:
|
||||||
logger.exception("failed at first fork")
|
logger.exception("failed at first fork")
|
||||||
os._exit(1) # pylint: disable=protected-access
|
os._exit(1) # pylint: disable=protected-access
|
||||||
|
|
||||||
os.setsid()
|
os.setsid() # pylint: disable=no-member
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pid = os.fork()
|
pid = os.fork() # pylint: disable=no-member
|
||||||
if pid > 0:
|
if pid > 0:
|
||||||
os._exit(0) # pylint: disable=protected-access
|
os._exit(0) # pylint: disable=protected-access
|
||||||
except OSError:
|
except OSError:
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ class System:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _reflink_linux(src, dst):
|
def _reflink_linux(src, dst):
|
||||||
import fcntl
|
import fcntl # pylint: disable=import-error
|
||||||
|
|
||||||
FICLONE = 0x40049409
|
FICLONE = 0x40049409
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -69,7 +69,7 @@ disable = [
|
|||||||
enable = ["c-extension-no-member", "no-else-return"]
|
enable = ["c-extension-no-member", "no-else-return"]
|
||||||
|
|
||||||
[tool.pylint.typecheck]
|
[tool.pylint.typecheck]
|
||||||
generated-members = ["pytest.lazy_fixture", "logging.TRACE", "logger.trace", "sys.getwindowsversion"]
|
generated-members = ["pytest.lazy_fixture", "logging.TRACE", "logger.trace", "sys.getwindowsversion", "argparse.Namespace"]
|
||||||
ignored-classes = ["Dvcfile"]
|
ignored-classes = ["Dvcfile"]
|
||||||
ignored-modules = ["azure"]
|
ignored-modules = ["azure"]
|
||||||
signature-mutators = ["funcy.decorators.decorator"]
|
signature-mutators = ["funcy.decorators.decorator"]
|
||||||
|
|||||||
@@ -134,7 +134,6 @@ tests =
|
|||||||
google-compute-engine==2.8.13
|
google-compute-engine==2.8.13
|
||||||
google-cloud-storage==1.42.3
|
google-cloud-storage==1.42.3
|
||||||
dvclive==0.4.1
|
dvclive==0.4.1
|
||||||
pywin32>=225; sys_platform == 'win32' and python_version < '3.10'
|
|
||||||
hdfs==2.6.0
|
hdfs==2.6.0
|
||||||
# required by collective.checkdocs
|
# required by collective.checkdocs
|
||||||
Pygments==2.10.0
|
Pygments==2.10.0
|
||||||
@@ -153,6 +152,8 @@ tests =
|
|||||||
types-requests==2.25.11
|
types-requests==2.25.11
|
||||||
types-tabulate==0.8.3
|
types-tabulate==0.8.3
|
||||||
types-toml==0.10.1
|
types-toml==0.10.1
|
||||||
|
# optional dependencies
|
||||||
|
pywin32>=225; sys_platform == 'win32'
|
||||||
|
|
||||||
[options.packages.find]
|
[options.packages.find]
|
||||||
exclude =
|
exclude =
|
||||||
|
|||||||
+7
-4
@@ -5,9 +5,12 @@ import sys
|
|||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import win32file # pylint: disable=import-error
|
try:
|
||||||
|
import win32file # pylint: disable=import-error
|
||||||
win32file._setmaxstdio(4096)
|
except ImportError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
win32file._setmaxstdio(4096)
|
||||||
|
|
||||||
# Workaround for two bugs:
|
# Workaround for two bugs:
|
||||||
#
|
#
|
||||||
@@ -34,7 +37,7 @@ if os.name == "nt":
|
|||||||
subprocess._cleanup = noop
|
subprocess._cleanup = noop
|
||||||
subprocess._active = None
|
subprocess._active = None
|
||||||
else:
|
else:
|
||||||
import resource
|
import resource # pylint: disable=import-error
|
||||||
|
|
||||||
resource.setrlimit(resource.RLIMIT_NOFILE, (4096, 4096))
|
resource.setrlimit(resource.RLIMIT_NOFILE, (4096, 4096))
|
||||||
|
|
||||||
|
|||||||
@@ -677,8 +677,12 @@ def temporary_windows_drive(tmp_path_factory):
|
|||||||
import string
|
import string
|
||||||
from ctypes import windll
|
from ctypes import windll
|
||||||
|
|
||||||
import win32api # pylint: disable=import-error
|
try:
|
||||||
from win32con import DDD_REMOVE_DEFINITION # pylint: disable=import-error
|
# pylint: disable=import-error
|
||||||
|
import win32api
|
||||||
|
from win32con import DDD_REMOVE_DEFINITION
|
||||||
|
except ImportError:
|
||||||
|
pytest.skip("pywin32 not installed")
|
||||||
|
|
||||||
drives = [
|
drives = [
|
||||||
s[0].upper()
|
s[0].upper()
|
||||||
@@ -999,7 +1003,7 @@ def test_add_preserve_meta(tmp_dir, dvc):
|
|||||||
# are the same 260 chars, which makes the test unnecessarily complex
|
# are the same 260 chars, which makes the test unnecessarily complex
|
||||||
@pytest.mark.skipif(os.name == "nt", reason="unsupported on Windows")
|
@pytest.mark.skipif(os.name == "nt", reason="unsupported on Windows")
|
||||||
def test_add_long_fname(tmp_dir, dvc):
|
def test_add_long_fname(tmp_dir, dvc):
|
||||||
name_max = os.pathconf(tmp_dir, "PC_NAME_MAX")
|
name_max = os.pathconf(tmp_dir, "PC_NAME_MAX") # pylint: disable=no-member
|
||||||
name = "a" * name_max
|
name = "a" * name_max
|
||||||
tmp_dir.gen({"data": {name: "foo"}})
|
tmp_dir.gen({"data": {name: "foo"}})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user