Skip to content

Commit 1887158

Browse files
authored
Swapped basename fallback function from os.tempnam to uuid (#626)
* Swapped from deprecated fallback file basename to UUID * Update python version to 3.9 * Fix version so only ubuntu is on 3.9 * Move frequent check to 3.9 * New compile args
1 parent 453bfb9 commit 1887158

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

.github/workflows/frequent_check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ jobs:
9191
- name: Set up Python
9292
uses: actions/setup-python@v5 # https://github.com/marketplace/actions/setup-python
9393
with:
94-
python-version: '3.7'
94+
python-version: '3.9'
9595
- name: configure
9696
run: |
9797
mkdir target-Release
9898
cd target-Release
99-
cmake .. -DCMAKE_INSTALL_PREFIX=install${{ matrix.os }}CMake-Github -DPYTHON_VERSION=3.7
99+
cmake .. -DCMAKE_INSTALL_PREFIX=install${{ matrix.os }}CMake-Github -DPYTHON_VERSION=3.9
100100
- name: make
101101
run: |
102102
cd target-Release

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ jobs:
9494
- name: Set up Python
9595
uses: actions/setup-python@v5 # https://github.com/marketplace/actions/setup-python
9696
with:
97-
python-version: '3.7'
97+
python-version: '3.9'
9898
- name: configure
9999
run: |
100100
mkdir target-Release
101101
cd target-Release
102-
cmake -DCMAKE_INSTALL_PREFIX=install${{ matrix.os }}CMake-Github -DPYTHON_VERSION=3.7 ..
102+
cmake -DCMAKE_INSTALL_PREFIX=install${{ matrix.os }}CMake-Github -DPYTHON_VERSION=3.9 ..
103103
- name: make
104104
run: |
105105
cd target-Release

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ if (${CMAKE_PROJECT_NAME} STREQUAL nitro)
2121
elseif (UNIX)
2222
add_compile_options(-Werror) # warnings as errors
2323

24+
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)
25+
add_compile_options(-Wno-error=c++20-compat -Wno-error=format-truncation)
26+
endif()
27+
2428
if (ENABLE_ASAN)
2529
# https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
2630
add_compile_options(-fsanitize=address)

modules/python/nitf/samples/nitf_extract.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"""
2626

2727
from nitf import *
28-
import os, sys, logging, glob
28+
import os, sys, logging, glob, uuid
2929

3030
logging.basicConfig(level=logging.INFO, stream=sys.stdout,
3131
format='%(asctime)s %(levelname)s %(message)s')
@@ -40,7 +40,7 @@ def extract_image(subheader, index, imageReader, outDir=None, baseName=None):
4040
bandData = imageReader.read(window)
4141

4242
if not outDir: outDir = os.getcwd()
43-
if not baseName: baseName = os.path.basename(os.tempnam())
43+
if not baseName: baseName = os.path.basename(uuid.uuid4().hex)
4444

4545
outNames = []
4646
for band, data in enumerate(bandData):

modules/python/nitf/samples/test_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"""
2626

2727
from nitf import *
28-
import os, sys, logging, glob
28+
import os, sys, logging, glob, uuid
2929
from PIL import Image
3030

3131
logging.basicConfig(level=logging.INFO, stream=sys.stdout,
@@ -41,7 +41,7 @@ def dump_image(subheader, index, imageReader, outDir=None, baseName=None):
4141
bandData = imageReader.read(window)
4242

4343
if not outDir: outDir = os.getcwd()
44-
if not baseName: baseName = os.path.basename(os.tempnam())
44+
if not baseName: baseName = os.path.basename(uuid.uuid4().hex)
4545

4646
outNames = []
4747
for band, data in enumerate(bandData):

0 commit comments

Comments
 (0)