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

Maturin sdists fails on Windows when using local dependencies #579

Closed
andfoy opened this issue Jun 25, 2021 · 4 comments · Fixed by #580
Closed

Maturin sdists fails on Windows when using local dependencies #579

andfoy opened this issue Jun 25, 2021 · 4 comments · Fixed by #580
Labels
bug Something isn't working

Comments

@andfoy
Copy link

andfoy commented Jun 25, 2021

Please provide the following information:

  • Your python version (python -V): 3.x
  • Your pip version (pip -V):
  • The version of the bindings you're using, if any (e.g. pyo3, rust-cpython or cffi): 0.13.2
  • Does cargo build work? Yes
  • If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)? Yes

Hi,

I've been trying to provide a source distribution for pywinpty (https://github.com/spyder-ide/pywinpty), which only works for Windows. This package depends on pywinpty_findlib, which is a local dependency that is specified in the Cargo.toml as follows:

[build-dependencies]
cxx-build = {version = "1.0.45", features = ["parallel"]}
pywinpty_findlib = { version = "=0.3.0", path = "findlib" }
which = "4.1.0"

When I try to invoke maturin sdist, it fails with the following message:

💥 maturin failed
  Caused by: Failed to build source distribution
  Caused by: Failed to add local dependency pywinpty_findlib at /C:/Users/quansight/pywinpty/findlib to the source distribution
  Caused by: Failed to query file list from cargo: exit code: 101
--- Stdout:

--- Stderr:
error: manifest path `/C:/Users/quansight/pywinpty/findlib\Cargo.toml` does not exist

My guess is that for some reason, forward and backward slashes are getting mixed up, which is preventing the correct localization of the local dependency Cargo.toml. This also occurs when calling maturin build, but not when calling maturin develop

@messense
Copy link
Member

messense commented Jun 26, 2021

It seems that on Windows cargo prints "pywinpty_findlib 0.3.0 (path+file:///Y:/Downloads/pywinpty/findlib)", so the regex here

let matcher = Regex::new(r"^(.*) .* \(path\+file://(.*)\)$").unwrap();

extracts /Y:/Downloads/pywinpty/findlib with a leading slash which caused the error.

Change the offending line to let matcher = Regex::new(r"^(.*) .* \(path\+file:///?(.*)\)$").unwrap(); could fix this on Windows but breaks Unix, then I hit alexcrichton/tar-rs#251 in maturin debug build (works fine in release build).

@messense messense added the bug Something isn't working label Jun 26, 2021
@messense
Copy link
Member

BTW, your pyproject.toml is missing the project.name field which is required by PEP 621.

@andfoy
Copy link
Author

andfoy commented Jun 28, 2021

Hi @messense, thanks for the heads up! I've just updated pywinpty accordingly

@messense
Copy link
Member

@andfoy Please try v0.11.0-beta.5: pip install --pre -U maturin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants