Skip to content

ue4cli depends on 'pkg_resources' which prevents it from running on vanilla python #71

@sleeptightAnsiC

Description

@sleeptightAnsiC

Looks like I missed this one during #59

ue4cli still depends on package outside of vanilla python and cannot be run directly from source without it:

$ python ~/ue4cli
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/korn/ue4cli/__main__.py", line 1, in <module>
    from ue4cli.cli import main
  File "/home/korn/ue4cli/ue4cli/cli.py", line 2, in <module>
    from .PluginManager import PluginManager
  File "/home/korn/ue4cli/ue4cli/PluginManager.py", line 2, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

For now, I only spotted pkg_resources (provided by setuptools) which is used in two places:

  1. pkg_resources.iter_entry_points
    # Retrieve the list of detected entry points in the ue4cli.plugins group
    plugins = {
    entry_point.name: entry_point.load()
    for entry_point
    in pkg_resources.iter_entry_points('ue4cli.plugins')
    }
  2. pkg_resources.parse_version
    def _editorPathSuffix(self, cmdVersion):
    version = parse_version(self.getEngineVersion())
    if version < parse_version('5.0.0'):
    return '.app/Contents/MacOS/UE4Editor'
    else:
    return '.app/Contents/MacOS/UnrealEditor'
    def _transformBuildToolPlatform(self, platform):
    # Prior to 4.22.2, Build.sh under Mac requires "macosx" as the platform name for macOS
    version = parse_version(self.getEngineVersion())
    return 'macosx' if platform == 'Mac' and version < parse_version('4.22.2') else platform

First one is tricky, we have to use it for loading ue4cli-plugins which is invoked in ue4cli/cli.py.
Second one should be fairly easy to replace (I hope).

TODO:
I gotta make sure there is no more dependencies like this one and find good workaround for this.
Perhaps we can try; import pkg_resources: and load ue4cli-plugins only if said dependency is resolved.

Either way, I'll probably take this one :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions