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

Add a provider for libraries in environmental folders #632

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

McSherry
Copy link

Overview

The main addition in this PR is fusesoc.providers.env.Env, which is meant to represent a library in a (not necessarily fixed) location in the environment. Specifically, included in this PR is a provider for Poetry that looks for the virtual environment set up by Poetry and adds it as a searchable location. An example fusesoc.conf would be:

[library.my-venv]
sync-type = env
sync-uri = poetry
auto-sync = true

This would invoke Poetry to find the active virtual environment each time it's needed. This would be added to the configuration with the command fusesoc library add --sync-type env my-venv poetry.

This provider can also be used to automatically produce a local provider by passing --no-auto-sync.

I've tried to make this general enough that it's straightforward to add other targets that follow the general theme of:

  • Probably created automatically
  • Exists locally (or somewhere that can be treated as locally)
  • Has a location that can be queried automatically

The main intention here is to make it easier to distribute FuseSoC cores (or bundles of cores) through a Python package manager.

Related changes

As well as that main change, this PR includes the following related changes that support this new provider:

  • In fusesoc.config.add_library, the call to init_library is moved to before the updates to the fusesoc.conf file to allow the new provider to check that it can resolve the environmental folder and to allow it to provide a resolved location if needed

  • In fusesoc.utils.Launcher, the Launcher.run method is adjusted to return a subprocess.Popen and to accept **kwargs (but otherwise should be compatible), which allows the Env provider to capture output from its invocation of Poetry

  • In fusesoc.coremanager.find_cores, a call to Env.resolve is added before directory walking takes place; this lets us avoid having the concrete location in fusesoc.conf as explicitly these types of folders may not have a fixed location

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

Successfully merging this pull request may close these issues.

None yet

1 participant