Skip to content

Commit 50c00f2

Browse files
Issue #198 Only install and use oschmod when it is a Windows system.
1 parent e64f576 commit 50c00f2

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

openeo/rest/auth/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
from pathlib import Path
1515
from typing import Union, Tuple, Dict
1616

17-
import oschmod
18-
1917
from openeo import __version__
2018
from openeo.config import get_user_config_dir, get_user_data_dir
2119
from openeo.util import rfc3339, deep_get, deep_set
2220

21+
if platform.system() == 'Windows':
22+
import oschmod
23+
24+
2325
_PRIVATE_PERMS = stat.S_IRUSR | stat.S_IWUSR
2426

2527
log = logging.getLogger(__name__)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
'xarray>=0.12.3',
4848
'pandas>0.20.0',
4949
'deprecated>=1.2.12',
50-
'oschmod',
50+
'oschmod; sys_platform == "win32"',
5151
'pywin32; sys_platform == "win32"',
5252
],
5353
extras_require={

tests/rest/auth/test_config.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,18 @@
22
from unittest import mock
33
import platform
44

5-
import oschmod
65
import pytest
76

87
import openeo.rest.auth.config
98
from openeo.rest.auth.config import RefreshTokenStore, AuthConfig, PrivateJsonFile
109

10+
# TODO: We could simplify the code if we can verify oschmod works transparently on Linux/Mac as well.
11+
# I think oschmod does work on Linux and Mac, but since it we use it for a
12+
# security sensitive feature, let's make sure there are no problems first.
13+
# For now, it is fine to have some Windows specific code.
14+
if platform.system() == 'Windows':
15+
import oschmod
16+
1117

1218
class TestPrivateJsonFile:
1319

0 commit comments

Comments
 (0)