indygreg / PyOxidizer

A modern Python application packaging and distribution tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pyoxidizer icon

YUHONGYUANYU opened this issue · comments

I'd like to be able customize the icon of the produced .exe file on Windows,
image
the i compile it, but the compiled exe was default icon and did not has a msi installer

Hello, I'm trying to add the icon just like you did, but it's not showing up. Were you able to resolve it?
PyOxidizer version 0.24.0
My .bzl file:


def make_exe():
    dist = default_python_distribution()
    policy = dist.make_python_packaging_policy()
    policy.resources_location_fallback = "filesystem-relative:lib"
    python_config = dist.make_python_interpreter_config()
    python_config.run_command = "from main import main; main()"
    exe = dist.to_python_executable(
        name="epic-alert",
        packaging_policy=policy,
        config=python_config,
    )
    for resource in exe.pip_install(["-r", "requirements.txt"]):
        resource.add_location = "filesystem-relative:lib"
        exe.add_python_resource(resource)
    exe.windows_subsystem = "windows"
    exe.add_python_resources(exe.read_package_root(
        path=".",
        packages=["main", "auto_buy_game", "file_manager", "main_tray_icon", "main_window", "notification_windows", "ui_app_dialog"],))
    return exe

def make_embedded_resources(exe):
    return exe.to_embedded_resources()

def make_install(exe):  
    files = FileManifest()
    # Add the generated executable to our install layout in the root directory.
    files.add_python_resource(".", exe)
    return files

def make_msi(exe):
    # See the full docs for more. But this will convert your Python executable
    # .msi installer when it is built.
    #exe.windows_subsystem("windows")
    msi_builder = exe.to_wix_msi_builder(
        # Simple identifier of your app.
        "epic-alert",
        # The name of your application.
        "Epic Alert",
        # The version of your application.
        "0",
        # The author/manufacturer of your application.
        "Alan Luque",        
    )
    msi_builder.product_icon_path= "J:\\Documentos\\python\\auto-buy-game\\build_py2exe\\build_pyobxidian\\warning.ico"
    return msi_builder

def register_code_signers():
    # this if block to be evaluated.
    if not VARS.get("ENABLE_CODE_SIGNING"):
        return

register_code_signers()
register_target("exe", make_exe)
register_target("resources", make_embedded_resources, depends=["exe"], default_build_script=True)
register_target("install", make_install, depends=["exe"], default=True)
register_target("msi_installer", make_msi, depends=["exe"])
resolve_targets()

Is this a bug or am I doing something wrong?