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

Rust support breaks for non-crates.io dependency #67

Open
Pat-Lafon opened this issue Feb 27, 2022 · 1 comment
Open

Rust support breaks for non-crates.io dependency #67

Pat-Lafon opened this issue Feb 27, 2022 · 1 comment

Comments

@Pat-Lafon
Copy link

Hi, this is very cool.

I was looking to run it on one of my rust projects after reading the It-depends blog post however it seems to crash if it can't find a dependency on crates.io. For my project, some of my dependencies are libraries that are stored locally in the same repository as the project. One of these is described in my Cargo.toml file as:

[dependencies.bril2json]
version      = "0.1.0"
path         = "../bril-rs/bril2json"

I believe the expected behavior would be to look up the crate at the following path as an alternative location(in fact it should probably be the first location searched if provided). I've included the output I received from running it-depends .

/opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/_distutils_hack/__init__.py:30: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
resolving .:  91%|████████████████████████████████████████████████████████▏     | 115/127 [00:00<00:00, 427.84 dependencies/s]     Created binary (application) package 
    Created binary (application) package
     Created binary (application) package
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Updating crates.io index
error: no matching package named `bril2json` found
location searched: registry `crates-io`
required by package `tmpfdsfp3rm v0.1.0 (/private/var/folders/_5/8cyj_28144g15vmx7gt8n41r0000gn/T/tmpfdsfp3rm)`
    Updating crates.io index
Traceback (most recent call last):                                                                                            
  File "/opt/homebrew/bin/it-depends", line 8, in <module>
    sys.exit(main())
  File "/opt/homebrew/lib/python3.9/site-packages/it_depends/cli.py", line 176, in main
    package_list = resolve(
  File "/opt/homebrew/lib/python3.9/site-packages/it_depends/dependencies.py", line 970, in resolve
    result = finished.result()
  File "/opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/it_depends/dependencies.py", line 777, in _process_dep
    return _DependencyResult(dep=dep, packages=list(dep.resolver.resolve(dep)), depth=depth)
  File "/opt/homebrew/lib/python3.9/site-packages/it_depends/cargo.py", line 150, in resolve
    self.resolve_from_source(SourceRepository(path=tmpdir), cache)
  File "/opt/homebrew/lib/python3.9/site-packages/it_depends/cargo.py", line 111, in resolve_from_source
    for package in get_dependencies(repo, check_for_cargo=False):
  File "/opt/homebrew/lib/python3.9/site-packages/it_depends/cargo.py", line 46, in get_dependencies
    metadata = json.loads(subprocess.check_output(["cargo", "metadata", "--format-version", "1"], cwd=repo.path))
  File "/opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/opt/homebrew/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['cargo', 'metadata', '--format-version', '1']' returned non-zero exit status 101.
    Blocking waiting for file lock on package cache
    Updating crates.io index
    Blocking waiting for file lock on package cache
@xanderdunn
Copy link

I would like to extend this to include Cargo dependencies that are not in crates.io, but are git dependencies. Example:

[dependencies]
ic-crypto-sha = { git = "https://github.com/dfinity/ic/", rev = "2ba560825f4c256e4665935bd841cdd6e08d1ca1"}
ic-types = { git = "https://github.com/dfinity/ic/", rev = "2ba560825f4c256e4665935bd841cdd6e08d1ca1"}

This produces error: no matching package named

@Pat-Lafon Pat-Lafon changed the title Rust support breaks on local dependency Rust support breaks for non-crates.io dependency Jun 22, 2022
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