Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 41 additions & 14 deletions relenv/build/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pathlib
import tempfile
from .common import *
from ..common import arches, LINUX
from ..common import arches, LINUX, Version


ARCHES = arches[LINUX]
Expand Down Expand Up @@ -393,6 +393,43 @@ def build_python(env, dirs, logfp):
env["OPENSSL_LDFLAGS"] = f"-L{dirs.prefix}/lib"
env["CFLAGS"] = f"-Wno-coverage-mismatch {env['CFLAGS']}"

runcmd(
[
"sed",
"-i",
"s/#readline readline.c -lreadline -ltermcap/readline readline.c -lreadline -ltinfow/g",
"Modules/Setup",
]
)
if Version.parse_string(env["RELENV_PY_MAJOR_VERSION"]) <= Version.parse_string(
"3.10"
):
runcmd(
[
"sed",
"-i",
(
"s/#_curses -lncurses -lncursesw -ltermcap _cursesmodule.c"
"/_curses -lncursesw -ltinfow _cursesmodule.c/g"
),
"Modules/Setup",
]
)
runcmd(
[
"sed",
"-i",
(
"s/#_curses_panel _curses_panel.c -lpanel -lncurses"
"/_curses_panel _curses_panel.c -lpanelw -lncursesw/g"
),
"Modules/Setup",
]
)
else:
env["CURSES_LIBS"] = "-lncursesw -ltinfow"
env["PANEL_LIBS"] = "-lpanelw"

cmd = [
"./configure",
"-v",
Expand Down Expand Up @@ -421,14 +458,7 @@ def build_python(env, dirs, logfp):
]

runcmd(cmd, env=env, stderr=logfp, stdout=logfp)
runcmd(
[
"sed",
"-i",
"s/#readline readline.c -lreadline -ltermcap/readline readline.c -lreadline -ltinfow/g",
"Modules/Setup",
]
)

with io.open("Modules/Setup", "a+") as fp:
fp.seek(0, io.SEEK_END)
fp.write("*disabled*\n" "_tkinter\n" "nsl\n" "nis\n")
Expand Down Expand Up @@ -534,11 +564,8 @@ def build_python(env, dirs, logfp):
build_func=build_ncurses,
download={
"url": "https://ftp.gnu.org/pub/gnu/ncurses/ncurses-{version}.tar.gz",
# XXX: Need to work out tinfo linkage
# "version": "6.5",
# "checksum": "cde3024ac3f9ef21eaed6f001476ea8fffcaa381",
"version": "6.4",
"checksum": "bb5eb3f34b3ecd5bac8d0b58164b847f135b3d62",
"version": "6.5",
"checksum": "cde3024ac3f9ef21eaed6f001476ea8fffcaa381",
"checkfunc": tarball_version,
},
)
Expand Down
96 changes: 96 additions & 0 deletions relenv/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,3 +727,99 @@ def sanitize_sys_path(sys_path_entries):
if p not in __sys_path:
__sys_path.append(p)
return __sys_path


class Version:
"""
Version comparisons.
"""

def __init__(self, data):
self.major, self.minor, self.micro = self.parse_string(data)
self._data = data

def __str__(self):
"""
Version as string.
"""
_ = f"{self.major}"
if self.minor is not None:
_ += f".{self.minor}"
if self.micro is not None:
_ += f".{self.micro}"
# XXX What if minor was None but micro was an int.
return _

@staticmethod
def parse_string(data):
"""
Parse a version string into major, minor, and micro integers.
"""
parts = data.split(".")
if len(parts) == 1:
return int(parts[0]), None, None
elif len(parts) == 2:
return int(parts[0]), int(parts[1]), None
elif len(parts) == 3:
return int(parts[0]), int(parts[1]), int(parts[2])
else:
raise RuntimeError("Too many parts to parse")

def __eq__(self, other):
"""
Equality comparisons.
"""
mymajor = 0 if self.major is None else self.major
myminor = 0 if self.minor is None else self.minor
mymicro = 0 if self.micro is None else self.micro
major = 0 if other.major is None else other.major
minor = 0 if other.minor is None else other.minor
micro = 0 if other.micro is None else other.micro
return mymajor == major and myminor == minor and mymicro == micro

def __lt__(self, other):
"""
Less than comparrison.
"""
mymajor = 0 if self.major is None else self.major
myminor = 0 if self.minor is None else self.minor
mymicro = 0 if self.micro is None else self.micro
major = 0 if other.major is None else other.major
minor = 0 if other.minor is None else other.minor
micro = 0 if other.micro is None else other.micro
if mymajor < major:
return True
elif mymajor == major:
if myminor < minor:
return True
if myminor == minor and mymicro < micro:
return True
return False

def __le__(self, other):
"""
Less than or equal to comparrison.
"""
mymajor = 0 if self.major is None else self.major
myminor = 0 if self.minor is None else self.minor
mymicro = 0 if self.micro is None else self.micro
major = 0 if other.major is None else other.major
minor = 0 if other.minor is None else other.minor
micro = 0 if other.micro is None else other.micro
if mymajor <= major:
if myminor <= minor:
if mymicro <= micro:
return True
return False

def __gt__(self, other):
"""
Greater than comparrison.
"""
return not self.__le__(other)

def __ge__(self, other):
"""
Greater than or equal to comparrison.
"""
return not self.__lt__(other)
2 changes: 1 addition & 1 deletion relenv/python-versions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"versions": ["3.13.5", "3.13.4", "3.13.3", "3.13.2", "3.13.1", "3.13.0", "3.12.11", "3.12.10", "3.12.9", "3.12.8", "3.12.7", "3.12.6", "3.12.5", "3.12.4", "3.12.3", "3.12.2", "3.12.1", "3.12.0", "3.11.13", "3.11.12", "3.11.11", "3.11.10", "3.11.9", "3.11.8", "3.11.7", "3.11.6", "3.11.5", "3.11.4", "3.11.3", "3.11.2", "3.11.1", "3.11.0", "3.10.18", "3.10.17", "3.10.16", "3.10.15", "3.10.14", "3.10.13", "3.10.12", "3.10.11", "3.10.10", "3.10.9", "3.10.8", "3.10.7", "3.10.6", "3.10.5", "3.10.4", "3.10.3", "3.10.2", "3.10.1", "3.10.0", "3.9.23", "3.9.22", "3.9.21", "3.9.20", "3.9.19", "3.9.18", "3.9.17", "3.9.16", "3.9.15", "3.9.14", "3.9.13", "3.9.12", "3.9.11", "3.9.10", "3.9.9", "3.9.8", "3.9.7", "3.9.6", "3.9.5", "3.9.4", "3.9.2", "3.9.1", "3.9.0", "3.8.20", "3.8.19", "3.8.18", "3.8.17", "3.8.16", "3.8.15", "3.8.14", "3.8.13", "3.8.12", "3.8.11", "3.8.10", "3.8.9", "3.8.8", "3.8.7", "3.8.6", "3.8.5", "3.8.4", "3.8.3", "3.8.2", "3.8.1", "3.8.0", "3.7.17", "3.7.16", "3.7.15", "3.7.14", "3.7.13", "3.7.12", "3.7.11", "3.7.10", "3.7.9", "3.7.8", "3.7.7", "3.7.6", "3.7.5", "3.7.4", "3.7.3", "3.7.2", "3.7.1", "3.7.0", "3.6.15", "3.6.14", "3.6.13", "3.6.12", "3.6.11", "3.6.10", "3.6.9", "3.6.8", "3.6.7", "3.6.6", "3.6.5", "3.6.4", "3.6.3", "3.6.2", "3.6.1", "3.6.0", "3.5.10", "3.5.9", "3.5.8", "3.5.7", "3.5.6", "3.5.5", "3.5.4", "3.5.3", "3.5.2", "3.5.1", "3.5.0", "3.4.10", "3.4.9", "3.4.8", "3.4.7", "3.4.6", "3.4.5", "3.4.4", "3.4.3", "3.4.2", "3.4.1", "3.4.0", "3.3.7", "3.3.6", "3.3.5", "3.3.4", "3.3.3", "3.3.2", "3.3.1", "3.3.0", "3.2.6", "3.2.5", "3.2.4", "3.2.3", "3.2.2", "3.2.1", "3.2.0", "3.1.5", "3.1.4", "3.1.3", "3.1.2", "3.1.1", "3.1.0", "3.0.1", "3.0.0"]}
{"versions": ["3.13.7", "3.13.6", "3.13.5", "3.13.4", "3.13.3", "3.13.2", "3.13.1", "3.13.0", "3.12.11", "3.12.10", "3.12.9", "3.12.8", "3.12.7", "3.12.6", "3.12.5", "3.12.4", "3.12.3", "3.12.2", "3.12.1", "3.12.0", "3.11.13", "3.11.12", "3.11.11", "3.11.10", "3.11.9", "3.11.8", "3.11.7", "3.11.6", "3.11.5", "3.11.4", "3.11.3", "3.11.2", "3.11.1", "3.11.0", "3.10.18", "3.10.17", "3.10.16", "3.10.15", "3.10.14", "3.10.13", "3.10.12", "3.10.11", "3.10.10", "3.10.9", "3.10.8", "3.10.7", "3.10.6", "3.10.5", "3.10.4", "3.10.3", "3.10.2", "3.10.1", "3.10.0", "3.9.23", "3.9.22", "3.9.21", "3.9.20", "3.9.19", "3.9.18", "3.9.17", "3.9.16", "3.9.15", "3.9.14", "3.9.13", "3.9.12", "3.9.11", "3.9.10", "3.9.9", "3.9.8", "3.9.7", "3.9.6", "3.9.5", "3.9.4", "3.9.2", "3.9.1", "3.9.0", "3.8.20", "3.8.19", "3.8.18", "3.8.17", "3.8.16", "3.8.15", "3.8.14", "3.8.13", "3.8.12", "3.8.11", "3.8.10", "3.8.9", "3.8.8", "3.8.7", "3.8.6", "3.8.5", "3.8.4", "3.8.3", "3.8.2", "3.8.1", "3.8.0", "3.7.17", "3.7.16", "3.7.15", "3.7.14", "3.7.13", "3.7.12", "3.7.11", "3.7.10", "3.7.9", "3.7.8", "3.7.7", "3.7.6", "3.7.5", "3.7.4", "3.7.3", "3.7.2", "3.7.1", "3.7.0", "3.6.15", "3.6.14", "3.6.13", "3.6.12", "3.6.11", "3.6.10", "3.6.9", "3.6.8", "3.6.7", "3.6.6", "3.6.5", "3.6.4", "3.6.3", "3.6.2", "3.6.1", "3.6.0", "3.5.10", "3.5.9", "3.5.8", "3.5.7", "3.5.6", "3.5.5", "3.5.4", "3.5.3", "3.5.2", "3.5.1", "3.5.0", "3.4.10", "3.4.9", "3.4.8", "3.4.7", "3.4.6", "3.4.5", "3.4.4", "3.4.3", "3.4.2", "3.4.1", "3.4.0", "3.3.7", "3.3.6", "3.3.5", "3.3.4", "3.3.3", "3.3.2", "3.3.1", "3.3.0", "3.2.6", "3.2.5", "3.2.4", "3.2.3", "3.2.2", "3.2.1", "3.2.0", "3.1.5", "3.1.4", "3.1.3", "3.1.2", "3.1.1", "3.1.0", "3.0.1", "3.0.0"]}
98 changes: 1 addition & 97 deletions relenv/pyversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import sys
import time

from relenv.common import check_url, download_url, fetch_url_content
from relenv.common import Version, check_url, download_url, fetch_url_content

log = logging.getLogger(__name__)

Expand All @@ -43,102 +43,6 @@ def _ref_path(x):
return x.split('href="')[1].split('"')[0]


class Version:
"""
Version comparrisons.
"""

def __init__(self, data):
self.major, self.minor, self.micro = self.parse_string(data)
self._data = data

def __str__(self):
"""
Version as string.
"""
_ = f"{self.major}"
if self.minor is not None:
_ += f".{self.minor}"
if self.micro is not None:
_ += f".{self.micro}"
# XXX What if minor was None but micro was an int.
return _

@staticmethod
def parse_string(data):
"""
Parse a version string into major, minor, and micro integers.
"""
parts = data.split(".")
if len(parts) == 1:
return int(parts[0]), None, None
elif len(parts) == 2:
return int(parts[0]), int(parts[1]), None
elif len(parts) == 3:
return int(parts[0]), int(parts[1]), int(parts[2])
else:
raise RuntimeError("Too many parts to parse")

def __eq__(self, other):
"""
Equality comparrison.
"""
mymajor = 0 if self.major is None else self.major
myminor = 0 if self.minor is None else self.minor
mymicro = 0 if self.micro is None else self.micro
major = 0 if other.major is None else other.major
minor = 0 if other.minor is None else other.minor
micro = 0 if other.micro is None else other.micro
return mymajor == major and myminor == minor and mymicro == micro

def __lt__(self, other):
"""
Less than comparrison.
"""
mymajor = 0 if self.major is None else self.major
myminor = 0 if self.minor is None else self.minor
mymicro = 0 if self.micro is None else self.micro
major = 0 if other.major is None else other.major
minor = 0 if other.minor is None else other.minor
micro = 0 if other.micro is None else other.micro
if mymajor < major:
return True
elif mymajor == major:
if myminor < minor:
return True
if myminor == minor and mymicro < micro:
return True
return False

def __le__(self, other):
"""
Less than or equal to comparrison.
"""
mymajor = 0 if self.major is None else self.major
myminor = 0 if self.minor is None else self.minor
mymicro = 0 if self.micro is None else self.micro
major = 0 if other.major is None else other.major
minor = 0 if other.minor is None else other.minor
micro = 0 if other.micro is None else other.micro
if mymajor <= major:
if myminor <= minor:
if mymicro <= micro:
return True
return False

def __gt__(self, other):
"""
Greater than comparrison.
"""
return not self.__le__(other)

def __ge__(self, other):
"""
Greater than or equal to comparrison.
"""
return not self.__lt__(other)


def _release_urls(version, gzip=False):
if gzip:
tarball = f"https://www.python.org/ftp/python/{version}/Python-{version}.tgz"
Expand Down
Loading