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 (
Dependency,
ReleaseDownload,
MakeBuilder, MesonBuilder
)
from .base import 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
import os, shutil
import fileinput
@ -15,16 +11,21 @@ class Icu(Dependency):
name = "icu4c"
class Source(ReleaseDownload):
archive_src = Remotefile('icu4c-73_2-src.tgz',
'818a80712ed3caacd9b652305e01afc7fa167e6f2e94996da44b90c2ab604ce1',
'https://github.com/unicode-org/icu/releases/download/release-73-2/icu4c-73_2-src.tgz')
archive_data = Remotefile('icu4c-73_2-data.zip',
'ca1ee076163b438461e484421a7679fc33a64cd0a54f9d4b401893fa1eb42701',
'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')
archive_src = Remotefile(
"icu4c-73_2-src.tgz",
"818a80712ed3caacd9b652305e01afc7fa167e6f2e94996da44b90c2ab604ce1",
"https://github.com/unicode-org/icu/releases/download/release-73-2/icu4c-73_2-src.tgz",
)
archive_data = Remotefile(
"icu4c-73_2-data.zip",
"ca1ee076163b438461e484421a7679fc33a64cd0a54f9d4b401893fa1eb42701",
"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]
@ -48,28 +49,33 @@ class Icu(Dependency):
name="data",
)
extract_archive(
pj(neutralEnv('archive_dir'), self.meson_patch.name),
neutralEnv('source_dir'),
topdir='icu',
name= self.source_dir
pj(neutralEnv("archive_dir"), self.meson_patch.name),
neutralEnv("source_dir"),
topdir="icu",
name=self.source_dir,
)
patches = [
"icu4c_fix_static_lib_name_mingw.patch",
# "icu4c_android_elf64_st_info.patch",
# "icu4c_custom_data.patch",
# "icu4c_noxlocale.patch",
"icu4c_rpath.patch",
# "icu4c_build_config.patch",
"icu4c_wasm.patch",
]
"icu4c_fix_static_lib_name_mingw.patch",
# "icu4c_android_elf64_st_info.patch",
# "icu4c_custom_data.patch",
# "icu4c_noxlocale.patch",
"icu4c_rpath.patch",
# "icu4c_build_config.patch",
"icu4c_wasm.patch",
]
if platform.system() == "Windows":
if platform.system() == 'Windows':
class Builder(MesonBuilder):
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:
class Builder(MakeBuilder):
subsource_dir = "source"
make_install_targets = ["install"]
@ -100,14 +106,17 @@ class Icu(Dependency):
def set_env(self, env):
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):
if self.buildEnv.configInfo.build != "wasm":
context.skip()
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":
print("DATASUBDIR = data")
else:

View File

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

View File

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

View File

@ -1,12 +1,10 @@
import os
from .base import (
Dependency,
ReleaseDownload,
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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,12 +1,6 @@
import shutil
from .base import Dependency, ReleaseDownload, MesonBuilder
from .base import (
Dependency,
ReleaseDownload,
MesonBuilder)
from kiwixbuild.utils import Remotefile, pj, SkipCommand
from kiwixbuild._global import neutralEnv
from kiwixbuild.utils import Remotefile
class zlib(Dependency):
@ -15,13 +9,14 @@ class zlib(Dependency):
class Source(ReleaseDownload):
src_archive = Remotefile(
"zlib-1.2.12.tar.gz",
"91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9"
"91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9",
)
meson_patch = Remotefile(
"zlib_1.2.12-1_patch.zip",
"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]
#patches = ['zlib_std_libname.patch']
# patches = ['zlib_std_libname.patch']
Builder = MesonBuilder