diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index dbee89a3..fd389d3d 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -69,7 +69,7 @@ jobs: - uses: actions/setup-python@v3 with: - python-version: '3.10' + python-version: '3.12' - name: Setup run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5ebc6071..3cab9225 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: - uses: actions/setup-python@v3 with: - python-version: '3.10' + python-version: '3.12' - name: Setup run: | diff --git a/Makefile b/Makefile index c672c4b7..e3bbaa65 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ autoortho.pyz: lin_bin: autoortho_lin_$(VERSION).bin autoortho_lin_$(VERSION).bin: autoortho/*.py - docker run --rm -v `pwd`:/code ubuntu:focal /bin/bash -c "cd /code; ./buildreqs.sh; time make bin VERSION=$(VERSION)" + docker run --rm -v `pwd`:/code ubuntu:jammy /bin/bash -c "cd /code; ./buildreqs.sh; time make bin VERSION=$(VERSION)" mv autoortho_lin.bin $@ enter: @@ -19,7 +19,7 @@ autoortho/.version: echo "$(VERSION)" > $@ bin: autoortho/.version - python3.10 -m nuitka --verbose --verbose-output=nuitka.log \ + python3 -m nuitka --verbose --verbose-output=nuitka.log \ --linux-icon=autoortho/imgs/ao-icon.ico \ --enable-plugin=tk-inter \ --enable-plugin=eventlet \ @@ -39,7 +39,7 @@ _autoortho_win.exe: autoortho/.version --enable-plugin=eventlet \ --windows-icon-from-ico=autoortho/imgs/ao-icon.ico \ --assume-yes-for-downloads \ - --include-data-file=./autoortho/.version*=. \ + --include-data-file=./autoortho/.version*=./ \ --include-data-file=./autoortho/templates/*.html=templates/ \ --include-data-file=./autoortho/lib/windows/*=lib/windows/ \ --include-data-file=./autoortho/aoimage/*.dll=aoimage/ \ @@ -56,7 +56,7 @@ __main__.dist: autoortho/.version --enable-plugin=eventlet \ --windows-icon-from-ico=autoortho/imgs/ao-icon.ico \ --assume-yes-for-downloads \ - --include-data-file=./autoortho/.version*=. \ + --include-data-file=./autoortho/.version*=./ \ --include-data-file=./autoortho/templates/*.html=templates/ \ --include-data-file=./autoortho/lib/windows/*=lib/windows/ \ --include-data-file=./autoortho/aoimage/*.dll=aoimage/ \ diff --git a/autoortho/autoortho_fuse.py b/autoortho/autoortho_fuse.py index 3f518cd4..12b66f56 100644 --- a/autoortho/autoortho_fuse.py +++ b/autoortho/autoortho_fuse.py @@ -82,10 +82,10 @@ class AutoOrtho(Operations): def __init__(self, root, cache_dir='.cache'): log.info(f"ROOT: {root}") - self.dds_re = re.compile(".*/(\d+)[-_](\d+)[-_]((?!ZL)\S*)(\d{2}).dds") - self.ktx2_re = re.compile(".*/(\d+)[-_](\d+)[-_]((?!ZL)\D*)(\d+).ktx2") - self.dsf_re = re.compile(".*/[-+]\d+[-+]\d+.dsf") - self.ter_re = re.compile(".*/\d+[-_]\d+[-_](\D*)(\d+).ter") + self.dds_re = re.compile(r".*/(\d+)[-_](\d+)[-_]((?!ZL)\S*)(\d{2}).dds") + self.ktx2_re = re.compile(r".*/(\d+)[-_](\d+)[-_]((?!ZL)\D*)(\d+).ktx2") + self.dsf_re = re.compile(r".*/[-+]\d+[-+]\d+.dsf") + self.ter_re = re.compile(r".*/\d+[-_]\d+[-_](\D*)(\d+).ter") self.root = os.path.abspath(root) self.cache_dir = cache_dir diff --git a/autoortho/getortho.py b/autoortho/getortho.py index 76072b42..5e27f4be 100644 --- a/autoortho/getortho.py +++ b/autoortho/getortho.py @@ -261,10 +261,10 @@ def get(self, idx=0, session=requests): # Hack override maptype #maptype = "ARC" - MAPID = "s2cloudless-2020_3857" + MAPID = "s2cloudless-2023_3857" MATRIXSET = "g" MAPTYPES = { - "EOX": f"https://{server}.s2maps-tiles.eu/wmts/?layer={MAPID}&style=default&tilematrixset={MATRIXSET}&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fjpeg&TileMatrix={self.zoom}&TileCol={self.col}&TileRow={self.row}", + "EOX": f"https://{server}.s2maps-tiles.eu/wmts?layer={MAPID}&style=default&tilematrixset={MATRIXSET}&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fjpeg&TileMatrix={self.zoom}&TileCol={self.col}&TileRow={self.row}", "BI": f"https://ecn.t{server_num}.tiles.virtualearth.net/tiles/a{quadkey}.jpeg?g=13816", "GO2": f"http://khms{server_num}.google.com/kh/v=934?x={self.col}&y={self.row}&z={self.zoom}", "ARC": f"http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{self.zoom}/{self.row}/{self.col}", @@ -272,12 +272,21 @@ def get(self, idx=0, session=requests): "USGS": f"https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/{self.zoom}/{self.row}/{self.col}", "FIREFLY": f"https://fly.maptiles.arcgis.com/arcgis/rest/services/World_Imagery_Firefly/MapServer/tile/{self.zoom}/{self.row}/{self.col}" } + + + #if self.maptype.upper() == "EOX": + # session.headers.update({'referer': 'https://s2maps.eu/'}) + + self.url = MAPTYPES[self.maptype.upper()] #log.debug(f"{self} getting {url}") header = { "user-agent": "curl/7.68.0" } - + if self.maptype.upper() == "EOX": + log.info("EOX DETECTED") + header.update({'referer': 'https://s2maps.eu/'}) + time.sleep((self.attempt/10)) self.attempt += 1 @@ -288,6 +297,8 @@ def get(self, idx=0, session=requests): resp = 0 try: if use_requests: + # FIXME: Not the best way to set headers + session.headers = header #resp = session.get(self.url, stream=True) resp = session.get(self.url) status_code = resp.status_code diff --git a/buildreqs.sh b/buildreqs.sh index 7784aed8..8a192ac1 100755 --- a/buildreqs.sh +++ b/buildreqs.sh @@ -3,16 +3,18 @@ export DEBIAN_FRONTEND=noninteractive export TZ=America/New_York +#apt-get update +#apt-get install software-properties-common -y +#add-apt-repository ppa:deadsnakes/ppa -y apt-get update -apt-get install software-properties-common -y -add-apt-repository ppa:deadsnakes/ppa -y -apt-get update -apt-get install -y make curl patchelf python3.10 python3.10-tk zlib1g-dev \ - ccache python3.10-distutils python3.10-dev libjpeg-dev libturbojpeg0-dev build-essential +#apt-get install -y make curl patchelf python3.10 python3.10-tk zlib1g-dev \ +# ccache python3.10-distutils python3.10-dev libjpeg-dev libturbojpeg0-dev build-essential +apt-get install -y make curl patchelf python3-pip python3-tk zlib1g-dev \ + ccache python3-distutils python3-dev libjpeg-dev libturbojpeg0-dev build-essential -curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 +#curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 -python3.10 -m pip install -U pip -python3.10 -m pip install setuptools -python3.10 -m pip install -r requirements-build.txt --no-use-pep517 -python3.10 -m pip install -r requirements.txt +python3 -m pip install -U pip +python3 -m pip install setuptools +python3 -m pip install -r requirements-build.txt --no-use-pep517 +python3 -m pip install -r requirements.txt diff --git a/requirements-build.in b/requirements-build.in index 86df3f38..81bf5380 100644 --- a/requirements-build.in +++ b/requirements-build.in @@ -1,3 +1,3 @@ -nuitka==1.6.6 +nuitka==2.4.8 zstandard ordered-set diff --git a/requirements-build.txt b/requirements-build.txt index 52e9ad72..6af1055e 100644 --- a/requirements-build.txt +++ b/requirements-build.txt @@ -1,10 +1,10 @@ # -# This file is autogenerated by pip-compile with python 3.10 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: # # pip-compile requirements-build.in # -nuitka==1.6.6 +nuitka==2.4.8 # via -r requirements-build.in ordered-set==4.1.0 # via diff --git a/requirements.in b/requirements.in index 602f6b2c..0f2b9256 100644 --- a/requirements.in +++ b/requirements.in @@ -1,6 +1,6 @@ refuse psutil -pysimplegui +pysimplegui<5.0.0 Flask flask-socketio eventlet diff --git a/requirements.txt b/requirements.txt index e689829f..561eff87 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,82 +1,84 @@ # -# This file is autogenerated by pip-compile with python 3.10 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: # # pip-compile requirements.in # -bidict==0.22.1 +bidict==0.23.1 # via python-socketio -certifi==2023.7.22 +blinker==1.8.2 + # via flask +certifi==2024.8.30 # via requests -charset-normalizer==3.2.0 +charset-normalizer==3.3.2 # via requests -click==8.1.3 +click==8.1.7 # via # flask # geocoder decorator==5.1.1 # via ratelim -dnspython==2.3.0 +dnspython==2.6.1 # via eventlet -eventlet==0.33.3 +eventlet==0.37.0 # via -r requirements.in -exceptiongroup==1.1.3 - # via pytest -flask==2.2.2 +flask==3.0.3 # via # -r requirements.in # flask-socketio -flask-socketio==5.3.4 +flask-socketio==5.3.7 # via -r requirements.in -future==0.18.3 +future==1.0.0 # via geocoder geocoder==1.38.1 # via -r requirements.in -greenlet==2.0.2 +greenlet==3.1.1 # via eventlet -idna==3.4 +h11==0.14.0 + # via wsproto +idna==3.10 # via requests iniconfig==2.0.0 # via pytest -itsdangerous==2.1.2 +itsdangerous==2.2.0 # via flask -jinja2==3.1.2 +jinja2==3.1.4 # via flask -markupsafe==2.1.1 +markupsafe==2.1.5 # via # jinja2 # werkzeug -packaging==23.1 +packaging==24.1 # via # -r requirements.in # pytest -pluggy==1.2.0 +pluggy==1.5.0 # via pytest -psutil==5.9.2 +psutil==6.0.0 # via -r requirements.in -pysimplegui==4.60.4 +pysimplegui==4.70.1 # via -r requirements.in -pytest==7.4.0 +pytest==8.3.3 # via -r requirements.in -python-engineio==4.4.1 +python-engineio==4.9.1 # via python-socketio -python-socketio==5.8.0 +python-socketio==5.11.4 # via flask-socketio ratelim==0.1.6 # via geocoder refuse==0.0.4 # via -r requirements.in -requests==2.31.0 +requests==2.32.3 # via # -r requirements.in # geocoder +simple-websocket==1.0.0 + # via python-engineio six==1.16.0 - # via - # eventlet - # geocoder -tomli==2.0.1 - # via pytest -urllib3==2.0.4 + # via geocoder +urllib3==2.2.3 # via requests -werkzeug==2.2.2 +werkzeug==3.0.4 # via flask +wsproto==1.2.0 + # via simple-websocket