From 6eef9be73a884094755ed4390422b9adca05a86f Mon Sep 17 00:00:00 2001 From: Mike Swanson Date: Fri, 6 Sep 2019 14:43:50 -0700 Subject: [PATCH] use python3 only for building Python 2 is very near end-of-life, and Python3-compatible changes to a few scripts introduced compatibility problems with 2.7 again. It went unnoticed for me since my system symlinks "python" to "python3", but it broke the build on systems where that symlink is still python2. At this point in time, I feel it is worth targetting modern Python and forgetting about 2.7. --- COMPILING.adoc | 4 ++-- bootstrap/bootstrap | 3 +-- dist/pillow-compose | 2 +- dist/pillow-resize | 2 +- graphics/text/create_caption | 3 +-- graphics/text/image_dimensions.py | 2 +- graphics/text/rotate | 2 +- graphics/text/smtextgen | 2 +- graphics/text/textgen | 2 +- graphics/text/tint.py | 2 +- lumps/colormap/colormap | 2 +- lumps/dmxgus/gather_stats.py | 2 +- lumps/dmxgus/gen-ultramid | 2 +- lumps/genmidi/README.adoc | 5 ++--- lumps/genmidi/a2i-to-sbi | 2 +- lumps/genmidi/a2i_file.py | 2 +- lumps/genmidi/config.py | 2 +- lumps/genmidi/dumpgenmidi | 2 +- lumps/genmidi/genmidi.py | 2 +- lumps/genmidi/instrument.py | 2 +- lumps/genmidi/midi.py | 2 +- lumps/genmidi/mkgenmidi | 2 +- lumps/genmidi/sbi_file.py | 2 +- lumps/playpal/playpal | 2 +- lumps/textures/build-textures | 2 +- scripts/fix-gfx-offsets | 2 +- scripts/fix-map-names | 4 +--- scripts/makejson | 2 +- scripts/makepkgs | 2 +- scripts/music-duplicates | 2 +- scripts/simplecpp | 2 +- 31 files changed, 33 insertions(+), 38 deletions(-) diff --git a/COMPILING.adoc b/COMPILING.adoc index 5c85b6af..fd93d16d 100644 --- a/COMPILING.adoc +++ b/COMPILING.adoc @@ -17,8 +17,8 @@ Building the Freedoom IWADs pretty much simply requires the following: portability are most welcome!). On non-GNU systems, it might be available in a package and binary named as _gmake_. * _Python_: Freedoom uses several Python programs in its tree to - assist with building the IWADs. Both Python 2.7 and 3.x are fully - supported. + assist with building the IWADs. Python 3.x is required, we no + longer support Python 2. * _Pillow_: A Python image manipulation module that provides the features we need for scaling and composing various graphics of the game. diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index f7902ff6..b43c1ac3 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -1,6 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 -from __future__ import print_function import sys import struct diff --git a/dist/pillow-compose b/dist/pillow-compose index 6e64b546..c8344275 100755 --- a/dist/pillow-compose +++ b/dist/pillow-compose @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Simple and dumb Pillow-based compositor # Usage: pillow-compose src-img.png dst-img.png WIDTH HEIGHT diff --git a/dist/pillow-resize b/dist/pillow-resize index 154f7cb8..32d01c3c 100755 --- a/dist/pillow-resize +++ b/dist/pillow-resize @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Simple and dumb Pillow-based resizer # Usage: pillow-resize src-img.png dst-img.png WIDTH HEIGHT diff --git a/graphics/text/create_caption b/graphics/text/create_caption index b363d24b..1ce61130 100755 --- a/graphics/text/create_caption +++ b/graphics/text/create_caption @@ -1,8 +1,7 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # encoding: utf-8 # SPDX-License-Identifier: BSD-3-Clause -from __future__ import unicode_literals from PIL import Image, ImageFont, ImageDraw import sys import os diff --git a/graphics/text/image_dimensions.py b/graphics/text/image_dimensions.py index 8ce0a947..6eb9125e 100755 --- a/graphics/text/image_dimensions.py +++ b/graphics/text/image_dimensions.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause import re diff --git a/graphics/text/rotate b/graphics/text/rotate index 4ab5f78a..9b2d8957 100755 --- a/graphics/text/rotate +++ b/graphics/text/rotate @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause diff --git a/graphics/text/smtextgen b/graphics/text/smtextgen index 3b305c29..ce54468e 100755 --- a/graphics/text/smtextgen +++ b/graphics/text/smtextgen @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # Script to generate text graphics using the "small" (HUD) font. diff --git a/graphics/text/textgen b/graphics/text/textgen index fdb9985a..90dff0e7 100755 --- a/graphics/text/textgen +++ b/graphics/text/textgen @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # Script to generate menu and intermission screen 'text' graphics for diff --git a/graphics/text/tint.py b/graphics/text/tint.py index 5f4ee4aa..c3af9be8 100755 --- a/graphics/text/tint.py +++ b/graphics/text/tint.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: MIT # Copyright (c) 2017 Martin Miller, Nick Zatkovich diff --git a/lumps/colormap/colormap b/lumps/colormap/colormap index 3b57de49..bc12934e 100755 --- a/lumps/colormap/colormap +++ b/lumps/colormap/colormap @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (C) 2001 Colin Phipps # Copyright (C) 2008, 2013 Simon Howard # Parts copyright (C) 1999 by id Software (http://www.idsoftware.com/) diff --git a/lumps/dmxgus/gather_stats.py b/lumps/dmxgus/gather_stats.py index fe87e744..73202df4 100644 --- a/lumps/dmxgus/gather_stats.py +++ b/lumps/dmxgus/gather_stats.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # Script to gather statistics from MIDI files about instrument usage. diff --git a/lumps/dmxgus/gen-ultramid b/lumps/dmxgus/gen-ultramid index eaa44787..157783ff 100755 --- a/lumps/dmxgus/gen-ultramid +++ b/lumps/dmxgus/gen-ultramid @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # Config file generator for the DMXGUS lump / config file. diff --git a/lumps/genmidi/README.adoc b/lumps/genmidi/README.adoc index ebf422f5..5816321e 100644 --- a/lumps/genmidi/README.adoc +++ b/lumps/genmidi/README.adoc @@ -121,7 +121,7 @@ to specify a note you want to play. For example, for 'C#' in Octave -3: Once you're done, save your changes and type this to build a new GENMIDI for testing: - python mkgenmidi genmidi.lmp + python3 mkgenmidi genmidi.lmp To try it out, get a source port with OPL emulation support (eg. Chocolate Doom) and add genmidi.lmp on the command line, eg. @@ -137,8 +137,7 @@ editors instead of AT2. There's a useful script included that will do exactly this. Specify the name of the a2i file and the name of the desired output file, as follows: - python a2i-to-sbi snazzy.a2i snazzy.sbi + python3 a2i-to-sbi snazzy.a2i snazzy.sbi Don't forget to update config.py to use the .sbi version of the file instead of the .a2i version! - diff --git a/lumps/genmidi/a2i-to-sbi b/lumps/genmidi/a2i-to-sbi index 42702950..565159e4 100755 --- a/lumps/genmidi/a2i-to-sbi +++ b/lumps/genmidi/a2i-to-sbi @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause import a2i_file diff --git a/lumps/genmidi/a2i_file.py b/lumps/genmidi/a2i_file.py index d09bc180..e8e67426 100644 --- a/lumps/genmidi/a2i_file.py +++ b/lumps/genmidi/a2i_file.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # Module to load A2I (AdlibTracker 2) instrument files. diff --git a/lumps/genmidi/config.py b/lumps/genmidi/config.py index a1a0b784..48fae1ed 100644 --- a/lumps/genmidi/config.py +++ b/lumps/genmidi/config.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # Config file for GENMIDI file generation. diff --git a/lumps/genmidi/dumpgenmidi b/lumps/genmidi/dumpgenmidi index 31e17228..add554c0 100644 --- a/lumps/genmidi/dumpgenmidi +++ b/lumps/genmidi/dumpgenmidi @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # Dump the contents of a GENMIDI lump into separate .sbi instrument files, diff --git a/lumps/genmidi/genmidi.py b/lumps/genmidi/genmidi.py index ae81fc7e..93d6204f 100644 --- a/lumps/genmidi/genmidi.py +++ b/lumps/genmidi/genmidi.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # Module for interacting with Doom GENMIDI lumps. diff --git a/lumps/genmidi/instrument.py b/lumps/genmidi/instrument.py index b4e30720..226e1aee 100644 --- a/lumps/genmidi/instrument.py +++ b/lumps/genmidi/instrument.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # Module to load OPL instrument files. diff --git a/lumps/genmidi/midi.py b/lumps/genmidi/midi.py index 38b55287..c632a3a1 100644 --- a/lumps/genmidi/midi.py +++ b/lumps/genmidi/midi.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # Constants for MIDI notes. diff --git a/lumps/genmidi/mkgenmidi b/lumps/genmidi/mkgenmidi index f5d4ac3c..4ca14315 100755 --- a/lumps/genmidi/mkgenmidi +++ b/lumps/genmidi/mkgenmidi @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause import genmidi diff --git a/lumps/genmidi/sbi_file.py b/lumps/genmidi/sbi_file.py index 823a6d83..c507375b 100644 --- a/lumps/genmidi/sbi_file.py +++ b/lumps/genmidi/sbi_file.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # Module to load Creative SBI OPL instrument files. diff --git a/lumps/playpal/playpal b/lumps/playpal/playpal index 14d1e21c..7a828380 100755 --- a/lumps/playpal/playpal +++ b/lumps/playpal/playpal @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Script to generate the PLAYPAL lump used by the Doom engine, specifically the # which contains 14 alternative palettes which are used for various # environmental effects. The base palette from which these are derived is either diff --git a/lumps/textures/build-textures b/lumps/textures/build-textures index 498e4a97..ee173640 100755 --- a/lumps/textures/build-textures +++ b/lumps/textures/build-textures @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # Texture lump builder for Freedoom diff --git a/scripts/fix-gfx-offsets b/scripts/fix-gfx-offsets index 9b638559..60e1e6cb 100755 --- a/scripts/fix-gfx-offsets +++ b/scripts/fix-gfx-offsets @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause from os import path diff --git a/scripts/fix-map-names b/scripts/fix-map-names index 45fefdb9..1d12d98d 100755 --- a/scripts/fix-map-names +++ b/scripts/fix-map-names @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # fix-map-names - Fix map names in WAD files @@ -10,8 +10,6 @@ # or make target "test-map-names" ("-t" option). Make target "test" # ("-t" option) will run this and any other test. -from __future__ import print_function - # Imports import argparse diff --git a/scripts/makejson b/scripts/makejson index e127e6ff..20ae633e 100755 --- a/scripts/makejson +++ b/scripts/makejson @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause import hashlib diff --git a/scripts/makepkgs b/scripts/makepkgs index b6fa89f8..a48ebf50 100755 --- a/scripts/makepkgs +++ b/scripts/makepkgs @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause import os diff --git a/scripts/music-duplicates b/scripts/music-duplicates index 54b41764..0e52bd25 100755 --- a/scripts/music-duplicates +++ b/scripts/music-duplicates @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # Find duplicated music tracks and create a summary report of music diff --git a/scripts/simplecpp b/scripts/simplecpp index e84c8df7..7ba9aeb0 100755 --- a/scripts/simplecpp +++ b/scripts/simplecpp @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # SPDX-License-Identifier: BSD-3-Clause # # simple cpp-style preprocessor