Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails on Windows with latest Poetry resolve #114

Open
nikshankarnoble opened this issue May 27, 2024 · 1 comment
Open

Build fails on Windows with latest Poetry resolve #114

nikshankarnoble opened this issue May 27, 2024 · 1 comment

Comments

@nikshankarnoble
Copy link

nikshankarnoble commented May 27, 2024

Hi all!

Today I was going through the process of building the latest version 1.0.3.dev.1 of the launcher with the latest version of the AYON Python API as we required one of the fixes in 1.0.2 and the latest commit is still locked off to 1.0.1 in the Poetry lock file. I re-resolved the dependencies to generate a new lock file - which then built fine on Linux but failed on Windows 10 due to an issue with the cx_Freeze and lief libraries.

In a local clone of the develop branch, I updated the Poetry environment to the latest resolve:

.\tools\manage.ps1 create-env
.\.poetry\bin\poetry lock
.\.poetry\bin\poetry install

In the new resolve you should end out with cx-Freeze==6.12.0 and lief==0.14.1. Then when you try to run the build, it will fail with a TypeError:

.\tools\manage.ps1 build
...
running build_exe
Traceback (most recent call last):
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\setup.py", line 291, in <module>
    setup(
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\cx_Freeze\__init__.py", line 68, in setup
    setuptools.setup(**attrs)
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\setuptools\__init__.py", line 87, in setup
    return distutils.core.setup(**attrs)
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
    return run_commands(dist)
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
    dist.run_commands()
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\setuptools\dist.py", line 1208, in run_command
    super().run_command(command)
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
    cmd_obj.run()
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\cx_Freeze\command\build.py", line 176, in run
    self.run_command(cmd_name)
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
    self.distribution.run_command(command)
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\setuptools\dist.py", line 1208, in run_command
    super().run_command(command)
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
    cmd_obj.run()
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\cx_Freeze\command\build_exe.py", line 259, in run
    freezer.Freeze()
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\cx_Freeze\freezer.py", line 634, in Freeze
    self._freeze_executable(executable)
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\cx_Freeze\freezer.py", line 249, in _freeze_executable
    dependent_files = self.get_dependent_files(exe.base)
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\cx_Freeze\parser.py", line 119, in get_dependent_files
    dependent_files: Set[Path] = self._get_dependent_files(path)
  File "C:\Users\nik.shankar\Desktop\ayon-launcher\.venv\lib\site-packages\cx_Freeze\parser.py", line 67, in _get_dependent_files_lief
    binary = lief.PE.parse(raw, path.name)
TypeError: parse(): incompatible function arguments. The following argument types are supported:
    1. parse(filename: str, config: lief._lief.PE.ParserConfig = <lief._lief.PE.ParserConfig object at 0x0000018C4E479D90>) -> Optional[lief._lief.PE.Binary]
    2. parse(raw: list[int], config: lief._lief.PE.ParserConfig = <lief._lief.PE.ParserConfig object at 0x0000018C4E479DB0>) -> Optional[lief._lief.PE.Binary]
    3. parse(obj: Union[io.IOBase | os.PathLike], config: lief._lief.PE.ParserConfig = <lief._lief.PE.ParserConfig object at 0x0000018C4E479DD0>) -> Optional[lief._lief.PE.Binary]
System.Management.Automation.RemoteException
Invoked with types: FileIO, str

From reading through the changelogs for cx_Freeze (https://cx-freeze.readthedocs.io/en/stable/releasenotes.html#version-7-0-april-21 no. 179), it looks like the following PR fixed up the call in v7.0 to work with the changed signature in lief-0.14.0, but previous versions are incompatible with lief-0.14+ - although this isn't described in the dependencies and so Poetry will still resolve it:
marcelotduarte/cx_Freeze#2104

Since there is a particular version constraint for cx_Freeze-6.12.0 in the dependencies for ayon-launcher and I'm not across the reason for it, I didn't really want to change that - so I worked around this issue by simply adding a lief = "<0.14" constraint into the pyproject.toml, and that seems to be building fine for me now.

@antirotor do you know why the constraint on that particular cx_Freeze version is there in the dependencies? Just wondering if you think it's a better idea to update that, or constrain the lief version like I've done...

Thanks!
Nikhil

@iLLiCiTiT
Copy link
Member

Hello, @nikshankarnoble is this still an issue?

antirotor added a commit that referenced this issue Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants