Changeset 935:79a441954367


Ignore:
Timestamp:
04/27/19 12:25:49 (5 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

Windows build changes in setup.py for the new environment and py2exe (re #347).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • setup.py

    r919 r935  
    55from glob import glob
    66from distutils.core import setup
     7from pathlib import Path
    78
    89scriptdir=os.path.dirname(sys.argv[0])
     
    4041    gtkRuntimeDir = os.environ["GTKRTDIR"] if "GTKRTDIR" in os.environ else None
    4142    if gtkRuntimeDir:
    42         path = os.path.join("lib", "gtk-2.0", "2.10.0", "engines")
    43         data_files.append((os.path.join("library", path),
    44                            [os.path.join(gtkRuntimeDir, path, "libwimp.dll")]))
     43        if gtkRuntimeDir.endswith("/mingw32"):
     44            path = os.path.join("lib", "girepository-1.0")
     45            data_files.append((path,
     46                               glob(os.path.join(gtkRuntimeDir, path, "*"))))
    4547
    46         path = os.path.join("share", "themes", "MS-Windows", "gtk-2.0")
    47         data_files.append((os.path.join("library", path),
    48                            glob(os.path.join(gtkRuntimeDir, path, "*"))))
     48            files = {}
    4949
    50         path = os.path.join("share", "locale", "hu", "LC_MESSAGES")
    51         data_files.append((os.path.join("library", path),
    52                            glob(os.path.join(gtkRuntimeDir, path, "*"))))
    53         path = os.path.join("share", "icons", "hicolor")
    54         data_files.append((os.path.join("library", path),
    55                            glob(os.path.join(gtkRuntimeDir, path, "*"))))
     50            for components in [ ["lib", "girepository-1.0"],
     51                                ["lib", "gdk-pixbuf-2.0", "2.10.0"],
     52                                ["share", "icons"],
     53                                ["share", "locale", "hu"],
     54                                ["share", "locale", "en"],
     55                                ["share", "themes"],
     56                                ["share", "glib-2.0", "schemas"]]:
     57                path = os.path.join(*components)
     58                p = Path(os.path.join(gtkRuntimeDir, path))
     59                for f in p.glob("**/*"):
     60                    if f.is_file():
     61                        d = os.path.join(path, str(f.parent.relative_to(p)))
     62                        if d in files:
     63                            files[d].append(str(f))
     64                        else:
     65                            files[d] = [str(f)]
     66
     67            for path in files:
     68                data_files.append((path, files[path]))
     69            data_files.append(("",
     70                               [os.path.join(gtkRuntimeDir, "bin", "librsvg-2-2.dll"),
     71                                os.path.join(gtkRuntimeDir, "bin", "libcroco-0.6-3.dll")]))
     72        else:
     73            path = os.path.join("lib", "gtk-2.0", "2.10.0", "engines")
     74            data_files.append((os.path.join("library", path),
     75                               [os.path.join(gtkRuntimeDir, path, "libwimp.dll")]))
     76
     77            path = os.path.join("share", "themes", "MS-Windows", "gtk-2.0")
     78            data_files.append((os.path.join("library", path),
     79                               glob(os.path.join(gtkRuntimeDir, path, "*"))))
     80
     81            path = os.path.join("share", "locale", "hu", "LC_MESSAGES")
     82            data_files.append((os.path.join("library", path),
     83                               glob(os.path.join(gtkRuntimeDir, path, "*"))))
     84            path = os.path.join("share", "icons", "hicolor")
     85            data_files.append((os.path.join("library", path),
     86                               glob(os.path.join(gtkRuntimeDir, path, "*"))))
    5687
    5788    cefDir = os.environ.get("CEFDIR")
    5889    if cefDir:
    59         for fileName in ["icudt.dll", "subprocess.exe"]:
     90        for fileName in ["icudtl.dat", "subprocess.exe", "natives_blob.bin",
     91                         "snapshot_blob.bin", "v8_context_snapshot.bin",
     92                         "cef.pak", "cef_100_percent.pak",
     93                         "cef_200_percent.pak", "cef_extensions.pak"]:
    6094            data_files.append(("", [os.path.join(cefDir, fileName)]))
    6195
     
    132166                 { "script" : "mlxupdate.py",
    133167                   "uac_info" : "requireAdministrator"}],
    134       options = { "py2exe" : { "includes": "gio, pango, atk, pangocairo, lxml._elementpath",
     168      options = { "py2exe" : { "packages" : "gi, lxml",
    135169                               "skip_archive": True} },
    136       zipfile = "library/.",
     170      zipfile = "library",
    137171      data_files = data_files,
    138172      platforms = ["Win32", "Linux"],
     
    141175
    142176if os.name=="nt":
    143     os.rename(os.path.join(scriptdir, "dist", "library", "libcef.dll"),
    144               os.path.join(scriptdir, "dist", "libcef.dll"))
    145177    mlx.update.buildManifest(os.path.join(scriptdir, "dist"))
    146178    with open(os.path.join(scriptdir, "dist", "Uninstall.conf"), "wt") as f:
Note: See TracChangeset for help on using the changeset viewer.