Skip to content

Commit

Permalink
Fix building toolchain on Ubuntu 24.04 (#6)
Browse files Browse the repository at this point in the history
* Fix python 3.12 warnings.
* Replace obsoleted function.
* Rename toolchain-m68k to toolchain-m68k.py
* Introduce shell script toolchain-m68k.
* Use Python Virtual Environments to build project.
  • Loading branch information
cahirwpz authored Jan 2, 2025
1 parent e29a53d commit afc13d1
Show file tree
Hide file tree
Showing 6 changed files with 471 additions and 463 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.ropeproject
.build-*/
.pc/
.venv/
m68k-amigaos/
tmp/
commodore
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ RUN apt-get install -y --no-install-recommends \
libsdl2-dev libsdl2-ttf-dev libopenal-dev libtool make patch \
pkg-config python3 python3-dev python3-pip quilt texinfo zip
COPY requirements.txt .
RUN pip3 install --break-system-packages -r requirements.txt
RUN python3 -m venv .venv
RUN source .venv/bin/activate && \
pip install --no-cache-dir -r requirements.txt
16 changes: 7 additions & 9 deletions common.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#!/usr/bin/env python3 -B

from __future__ import print_function

from fnmatch import fnmatch
from glob import glob
from logging import debug, info, error
from os import path
import contextlib
from distutils import spawn
import os
from multiprocessing import cpu_count
import shutil
Expand All @@ -27,7 +24,7 @@ def setvar(**kwargs):


def fill_in(value):
if type(value) == str:
if type(value) is str:
return value.format(**VARS)
return value

Expand All @@ -45,9 +42,9 @@ def flatten(*args):

while queue:
item = queue.pop(0)
if type(item) == list:
if type(item) is list:
queue = item + queue
elif type(item) == tuple:
elif type(item) is tuple:
queue = list(item) + queue
else:
yield item
Expand All @@ -74,7 +71,7 @@ def topdir(name):

@fill_in_args
def find_executable(name):
return (spawn.find_executable(name) or
return (shutil.which(name) or
panic('Executable "%s" not found!', name))


Expand All @@ -101,7 +98,7 @@ def find(root, **kwargs):
def touch(name):
try:
os.utime(name, None)
except:
except OSError:
open(name, 'a').close()


Expand Down Expand Up @@ -353,6 +350,7 @@ def unpack(name, work_dir='{sources}', top_dir=None, dst_dir=None):
src = (glob(path.join('{archives}', name) + '*') +
glob(path.join('{submodules}', name) + '*'))[0]
except IndexError:
src = ""
panic('Missing files for "%s".', name)

dst = path.join(work_dir, dst_dir or name)
Expand Down Expand Up @@ -439,7 +437,7 @@ def require_header(headers, lang='c', errmsg='', symbol=None, value=None):
proc_stdin.append("#error")
proc_stdin.append("#endif")

proc_stdout, proc_stderr = proc.communicate('\n'.join(proc_stdin).encode())
_, _ = proc.communicate('\n'.join(proc_stdin).encode())
proc.wait()

if proc.returncode == 0:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
lhafile
setuptools
Loading

0 comments on commit afc13d1

Please sign in to comment.