diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 70e9ffe4..2f778b49 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,6 +24,7 @@ jobs: python -m pip install --upgrade pip pip install pylint==2.15.* pip install mock + pip install packaging pip install requests==2.28.* - name: Analysing the code with pylint run: | diff --git a/conda_env/gdal-dev.yml b/conda_env/gdal-dev.yml index c20086aa..89f124d0 100644 --- a/conda_env/gdal-dev.yml +++ b/conda_env/gdal-dev.yml @@ -12,6 +12,7 @@ dependencies: - bs4=4.11.* - lxml=4.9.* - matplotlib=3.4.3 + - packaging - autopep8=2.0.* - mock - twine diff --git a/conda_env/gdal-user.yml b/conda_env/gdal-user.yml index 322215a5..b39491d9 100644 --- a/conda_env/gdal-user.yml +++ b/conda_env/gdal-user.yml @@ -8,6 +8,7 @@ dependencies: - bs4=4.11.* - lxml=4.9.* - matplotlib=3.4.3 + - packaging - pip - pip: - wahoomc==4.3.0 diff --git a/setup.cfg b/setup.cfg index a51e2775..057123f3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,6 +17,8 @@ classifiers = [options] packages = wahoomc, wahoomc.init python_requires = >=3.10 +install_requires = + packaging [options.package_data] -wahoomc = resources/*.*, resources/*/*.*, resources/*/*/*.*, resources/*/*/*/*.*, tooling_win/*.*, tooling_win/*/*.*, tooling_win/*/*/*.*, tooling_win/*/*/*/*.* \ No newline at end of file +wahoomc = resources/*.*, resources/*/*.*, resources/*/*/*.*, resources/*/*/*/*.*, tooling_win/*.*, tooling_win/*/*.*, tooling_win/*/*/*.*, tooling_win/*/*/*/*.* diff --git a/tests/test_setup.py b/tests/test_setup.py index 36cb3f29..76de8183 100644 --- a/tests/test_setup.py +++ b/tests/test_setup.py @@ -4,7 +4,7 @@ import unittest import platform import os -import pkg_resources +from packaging.version import parse as parse_version # import custom python packages from wahoomc.setup_functions import is_program_installed, is_map_writer_plugin_installed, \ @@ -97,7 +97,7 @@ def test_version_constants_against_pypi(self): """ tests, if the version of constants.py is equal to the latest available version on PyPI """ - latest_version = pkg_resources.parse_version( + latest_version = parse_version( get_latest_pypi_version()).public self.assertEqual( diff --git a/wahoomc/setup_functions.py b/wahoomc/setup_functions.py index ad735ed7..2b181f58 100644 --- a/wahoomc/setup_functions.py +++ b/wahoomc/setup_functions.py @@ -10,7 +10,7 @@ import shutil from pathlib import Path import sys -import pkg_resources +from packaging.version import parse as parse_version # import custom python packages from wahoomc.file_directory_functions import delete_everything_in_folder, write_json_file_generic, \ @@ -52,7 +52,7 @@ def adjustments_due_to_breaking_changes(): # and not 'tooling_win/Osmosis' # - to cleanup, tooling_win/ dir files and folders are deleted here. if (version_last_run is None or \ - pkg_resources.parse_version(VERSION) <= pkg_resources.parse_version('4.2.1')) and \ + parse_version(VERSION) <= parse_version('4.2.1')) and \ platform.system() == "Windows": log.info( 'Last run was with version %s, deleting Windows Tooling files of %s directory due to possible bad files.', version_last_run, USER_TOOLING_WIN_DIR) @@ -254,7 +254,7 @@ def check_installed_version_against_latest_pypi(): # compare installed version against latest and issue a info if a new version is available if latest_version \ - and pkg_resources.parse_version(VERSION) < pkg_resources.parse_version(latest_version): + and parse_version(VERSION) < parse_version(latest_version): log.info('\n\nUpdate available! \ \nA new version of wahoomc is available: "%s". You have installed version "%s". \ \nUpgrade wahoomc with "pip install wahoomc --upgrade". \