Skip to content

Commit

Permalink
Merge branch 'feature/python38-compatible' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
DrRobsAT committed Feb 28, 2024
2 parents 82ec9f2 + 01ec15f commit 025c3fb
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 22 deletions.
16 changes: 11 additions & 5 deletions pyceps/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from argparse import ArgumentParser, Action
import logging
import tempfile
from typing import Tuple

from pyceps.fileio.cartoio import CartoStudy
from pyceps.fileio.precisionio import PrecisionStudy
Expand Down Expand Up @@ -260,7 +261,7 @@ def get_args():
return parser.parse_args()


def configure_logger(log_level: str) -> tuple[int, str]:
def configure_logger(log_level: str) -> Tuple[int, str]:
"""
Set logging console and file formats.
Expand Down Expand Up @@ -525,9 +526,14 @@ def run():
logging.shutdown()

# save log file to disk
os.close(log_fid)
shutil.copy(log_path, log_file)
print('import log saved to {}'.format(log_file))
if os.access(os.path.dirname(log_file), os.W_OK):
os.close(log_fid)
shutil.copy(log_path, log_file)
print('import log saved to {}'.format(log_file))
else:
print('cannot save log file, no write permission for {}'
.format(log_file))
os.close(log_fid)
os.remove(log_path)

# everything is done, visualize if requested
Expand All @@ -541,6 +547,6 @@ def run():
'pyCEPS Copyright (C) 2023 Robert Arnold\n'
'This program comes with ABSOLUTELY NO WARRANTY;\n'
'This is free software, and you are welcome to redistribute '
'it under certain conditions; see LICENSE.txt for details.'
'it under certain conditions; see LICENSE.txt for details.\n'
)
run()
5 changes: 5 additions & 0 deletions pyceps/fileio/pathtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import os
import re
import logging
import sys
import zipfile
import py7zr

Expand Down Expand Up @@ -346,6 +347,10 @@ def _path_open(self, filepath, pwd=None, mode='rb'):
return open(filepath, mode=mode)

def _zip_open(self, filepath, pwd=None, mode='rb'):
version = sys.version_info
if version.major == 3 and version.minor == 8:
return filepath.open(mode='r', pwd=pwd)

# mode "rb" has to be given to read as binary file-like, although
# not in documentation...?
return filepath.open(mode='rb', pwd=pwd)
Expand Down
9 changes: 5 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
dash >= 2.9.0
numpy >=1.21.6, <1.27.0
scipy >= 1.11.2
dash >= 2.15
numpy >=1.19.5, <1.26.0; python_version=='3.8'
numpy >=1.22.4, <2.0.0; python_version>='3.9'
scipy == 1.10.1; python_version=='3.8'
scipy >= 1.12; python_version>='3.9'
dash_bootstrap_components >= 1.4.2
dash_vtk >= 0.0.9
plotly >= 5.16.1
py7zr >= 0.20.8
30 changes: 17 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@

import io
import os
import sys
from shutil import rmtree

from setuptools import find_packages, setup, Command
from setuptools import find_packages, setup

# Package meta-data.
NAME = 'pyCEPS'
Expand All @@ -39,8 +37,22 @@
URL = 'https://github.com/medunigraz/pyCEPS'
EMAIL = 'robert.arnold@medunigraz.at'
AUTHOR = 'Robert Arnold'
REQUIRES_PYTHON = '>=3.9.0'
REQUIRES_PYTHON = '>=3.8'
VERSION = '{{VERSION_PLACEHOLDER}}'
CLASSIFIERS = [
# Trove classifiers
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Programming Language :: Python',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Science/Research',
]

# What packages are optional?
EXTRAS = {
Expand Down Expand Up @@ -94,13 +106,5 @@
extras_require=EXTRAS,
include_package_data=True, # include package data listed in MANIFEST.in
license=LICENSE,
classifiers=[
# Trove classifiers
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.9',
'Development Status :: 4 - Beta',
],
classifiers=CLASSIFIERS,
)

0 comments on commit 025c3fb

Please sign in to comment.