Clean up a bit import in dependencies.

This commit is contained in:
Matthieu Gautier 2024-04-30 10:33:28 +02:00
parent 676099fcc9
commit 06cad66925
9 changed files with 53 additions and 67 deletions

View File

@ -1,10 +1,6 @@
from .base import ( from .base import Dependency, ReleaseDownload, MakeBuilder, MesonBuilder
Dependency,
ReleaseDownload,
MakeBuilder, MesonBuilder
)
from kiwixbuild.utils import pj, SkipCommand, Remotefile, extract_archive from kiwixbuild.utils import pj, Remotefile, extract_archive
from kiwixbuild._global import get_target_step, neutralEnv from kiwixbuild._global import get_target_step, neutralEnv
import os, shutil import os, shutil
import fileinput import fileinput
@ -15,16 +11,21 @@ class Icu(Dependency):
name = "icu4c" name = "icu4c"
class Source(ReleaseDownload): class Source(ReleaseDownload):
archive_src = Remotefile('icu4c-73_2-src.tgz', archive_src = Remotefile(
'818a80712ed3caacd9b652305e01afc7fa167e6f2e94996da44b90c2ab604ce1', "icu4c-73_2-src.tgz",
'https://github.com/unicode-org/icu/releases/download/release-73-2/icu4c-73_2-src.tgz') "818a80712ed3caacd9b652305e01afc7fa167e6f2e94996da44b90c2ab604ce1",
archive_data = Remotefile('icu4c-73_2-data.zip', "https://github.com/unicode-org/icu/releases/download/release-73-2/icu4c-73_2-src.tgz",
'ca1ee076163b438461e484421a7679fc33a64cd0a54f9d4b401893fa1eb42701', )
'https://github.com/unicode-org/icu/releases/download/release-73-2/icu4c-73_2-data.zip') archive_data = Remotefile(
meson_patch = Remotefile('icu_73.2-2_patch.zip', "icu4c-73_2-data.zip",
'', "ca1ee076163b438461e484421a7679fc33a64cd0a54f9d4b401893fa1eb42701",
'https://wrapdb.mesonbuild.com/v2/icu_73.2-2/get_patch') "https://github.com/unicode-org/icu/releases/download/release-73-2/icu4c-73_2-data.zip",
)
meson_patch = Remotefile(
"icu_73.2-2_patch.zip",
"",
"https://wrapdb.mesonbuild.com/v2/icu_73.2-2/get_patch",
)
archives = [archive_src, archive_data, meson_patch] archives = [archive_src, archive_data, meson_patch]
@ -48,28 +49,33 @@ class Icu(Dependency):
name="data", name="data",
) )
extract_archive( extract_archive(
pj(neutralEnv('archive_dir'), self.meson_patch.name), pj(neutralEnv("archive_dir"), self.meson_patch.name),
neutralEnv('source_dir'), neutralEnv("source_dir"),
topdir='icu', topdir="icu",
name= self.source_dir name=self.source_dir,
) )
patches = [ patches = [
"icu4c_fix_static_lib_name_mingw.patch", "icu4c_fix_static_lib_name_mingw.patch",
# "icu4c_android_elf64_st_info.patch", # "icu4c_android_elf64_st_info.patch",
# "icu4c_custom_data.patch", # "icu4c_custom_data.patch",
# "icu4c_noxlocale.patch", # "icu4c_noxlocale.patch",
"icu4c_rpath.patch", "icu4c_rpath.patch",
# "icu4c_build_config.patch", # "icu4c_build_config.patch",
"icu4c_wasm.patch", "icu4c_wasm.patch",
] ]
if platform.system() == "Windows":
if platform.system() == 'Windows':
class Builder(MesonBuilder): class Builder(MesonBuilder):
def set_env(self, env): def set_env(self, env):
env['ICU_DATA_FILTER_FILE'] = pj(os.path.dirname(os.path.realpath(__file__)), "icu4c_data_filter.json") env["ICU_DATA_FILTER_FILE"] = pj(
os.path.dirname(os.path.realpath(__file__)),
"icu4c_data_filter.json",
)
else: else:
class Builder(MakeBuilder): class Builder(MakeBuilder):
subsource_dir = "source" subsource_dir = "source"
make_install_targets = ["install"] make_install_targets = ["install"]
@ -100,14 +106,17 @@ class Icu(Dependency):
def set_env(self, env): def set_env(self, env):
env["ICU_DATA_FILTER_FILE"] = pj( env["ICU_DATA_FILTER_FILE"] = pj(
os.path.dirname(os.path.realpath(__file__)), "icu4c_data_filter.json" os.path.dirname(os.path.realpath(__file__)),
"icu4c_data_filter.json",
) )
def _post_configure_script(self, context): def _post_configure_script(self, context):
if self.buildEnv.configInfo.build != "wasm": if self.buildEnv.configInfo.build != "wasm":
context.skip() context.skip()
context.try_skip(self.build_path) context.try_skip(self.build_path)
for line in fileinput.input(pj(self.build_path, "Makefile"), inplace=True): for line in fileinput.input(
pj(self.build_path, "Makefile"), inplace=True
):
if line == "#DATASUBDIR = data\n": if line == "#DATASUBDIR = data\n":
print("DATASUBDIR = data") print("DATASUBDIR = data")
else: else:

View File

@ -1,13 +1,10 @@
import os
from .base import ( from .base import (
Dependency, Dependency,
ReleaseDownload, ReleaseDownload,
MakeBuilder, MakeBuilder,
) )
from kiwixbuild.utils import Remotefile, pj, Defaultdict, SkipCommand, run_command from kiwixbuild.utils import Remotefile
from kiwixbuild._global import get_target_step
class LibCurl(Dependency): class LibCurl(Dependency):

View File

@ -1,8 +1,5 @@
import shutil, os
from .base import Dependency, GitClone, MesonBuilder from .base import Dependency, GitClone, MesonBuilder
from kiwixbuild.utils import pj, copy_tree from kiwixbuild._global import option
from kiwixbuild._global import option, get_target_step, neutralEnv
class Libkiwix(Dependency): class Libkiwix(Dependency):

View File

@ -1,12 +1,10 @@
import os
from .base import ( from .base import (
Dependency, Dependency,
ReleaseDownload, ReleaseDownload,
MakeBuilder, MakeBuilder,
) )
from kiwixbuild.utils import Remotefile, pj, SkipCommand, run_command from kiwixbuild.utils import Remotefile, pj, run_command
from kiwixbuild._global import get_target_step from kiwixbuild._global import get_target_step

View File

@ -1,8 +1,6 @@
import shutil
from .base import Dependency, ReleaseDownload, MakeBuilder, QMakeBuilder from .base import Dependency, ReleaseDownload, MakeBuilder, QMakeBuilder
from kiwixbuild.utils import Remotefile, pj, SkipCommand from kiwixbuild.utils import Remotefile, pj
class Qt(Dependency): class Qt(Dependency):

View File

@ -1,9 +1,7 @@
import os import os
from .base import Dependency, ReleaseDownload, Builder from .base import Dependency, ReleaseDownload, Builder
from kiwixbuild.utils import Remotefile, add_execution_right, run_command from kiwixbuild.utils import Remotefile, add_execution_right, run_command, pj
pj = os.path.join
class android_ndk(Dependency): class android_ndk(Dependency):

View File

@ -1,9 +1,5 @@
import os
from .base import Dependency, ReleaseDownload, Builder from .base import Dependency, ReleaseDownload, Builder
from kiwixbuild.utils import Remotefile, run_command, copy_tree from kiwixbuild.utils import pj, Remotefile, run_command, copy_tree
pj = os.path.join
class emsdk(Dependency): class emsdk(Dependency):

View File

@ -3,8 +3,6 @@ import os
from .base import Dependency, NoopSource, Builder from .base import Dependency, NoopSource, Builder
from kiwixbuild.utils import Remotefile, add_execution_right, run_command from kiwixbuild.utils import Remotefile, add_execution_right, run_command
pj = os.path.join
class org_kde(Dependency): class org_kde(Dependency):
neutral = False neutral = False

View File

@ -1,12 +1,6 @@
import shutil from .base import Dependency, ReleaseDownload, MesonBuilder
from .base import ( from kiwixbuild.utils import Remotefile
Dependency,
ReleaseDownload,
MesonBuilder)
from kiwixbuild.utils import Remotefile, pj, SkipCommand
from kiwixbuild._global import neutralEnv
class zlib(Dependency): class zlib(Dependency):
@ -15,13 +9,14 @@ class zlib(Dependency):
class Source(ReleaseDownload): class Source(ReleaseDownload):
src_archive = Remotefile( src_archive = Remotefile(
"zlib-1.2.12.tar.gz", "zlib-1.2.12.tar.gz",
"91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9" "91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9",
) )
meson_patch = Remotefile( meson_patch = Remotefile(
"zlib_1.2.12-1_patch.zip", "zlib_1.2.12-1_patch.zip",
"8ec8344f3fe7b06ad4be768fd416694bc56cb4545ce78b0f1c18b3e72b3ec936", "8ec8344f3fe7b06ad4be768fd416694bc56cb4545ce78b0f1c18b3e72b3ec936",
"https://wrapdb.mesonbuild.com/v2/zlib_1.2.12-1/get_patch") "https://wrapdb.mesonbuild.com/v2/zlib_1.2.12-1/get_patch",
)
archives = [src_archive, meson_patch] archives = [src_archive, meson_patch]
#patches = ['zlib_std_libname.patch'] # patches = ['zlib_std_libname.patch']
Builder = MesonBuilder Builder = MesonBuilder