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

Read dependencies from wheels #184

Open
andreymal opened this issue Aug 23, 2019 · 1 comment
Open

Read dependencies from wheels #184

andreymal opened this issue Aug 23, 2019 · 1 comment

Comments

@andreymal
Copy link

Wheels already have dependencies info in *.dist-info/METADATA. How about parse and download it automatically? Now my pypi_wheels list is monstrously long because pynsist does not download dependencies automatically, and it may break in the future when some dependencies change and I forget to update this list.

@albertogomcas
Copy link

I agree that maintaining transitive dependencies is a pain.

As a workaround, I made a small script that at least cuts through several hours of trial & error and leaves to you just fixing the packages without a wheel.

import glob
import os
import shutil
import subprocess

PACKAGE = "mypackage"
wheels_folder = "wheels"

if __name__ == "__main__":
    shutil.rmtree(wheels_folder)
    subprocess.call(f"pip wheel . -w {wheels_folder}") # key line here, make a wheel of your package, use pip to pull deps

    wheels = glob.glob(f"{wheels_folder}/*.whl")

    deps = {}

    with open(f"{wheels_folder}/wheel_list.txt", "wt+") as f:
        for wheel in wheels:
            print(os.path.basename(wheel))
            pkgname, version, *_ = os.path.basename(wheel).split("-")
            if pkgname != PACKAGE:
                f.write(f"{pkgname}=={version}\n")
            else:
                os.remove(wheel)

Out of this you get a folder with all wheels (including transitive deps), which you can just include with local_wheels=wheels/*.whl or alternatively a text file with the listed wheels which you can copy-paste into the pynsist config file (with a little more work you could fill a config template file instead). The only trick I needed is to skip the wheel of the mypackage itself.

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