Skip to content

Commit

Permalink
Fix starting 'flit install' with statically specified PEP 621 metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
takluyver committed Mar 8, 2021
1 parent 58d9d04 commit e25a38e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 3 additions & 3 deletions flit/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,12 @@ def install_requirements(self):
def install_reqs_my_python_if_needed(self):
"""Install requirements to this environment if needed.
We can normally get the module's docstring and version number without
importing it, but if we do need to import it, we may need to install
We can normally get the summary and version number without import the
module, but if we do need to import it, we may need to install
its requirements for the Python where flit is running.
"""
try:
common.get_info_from_module(self.module)
common.get_info_from_module(self.module, self.ini_info.dynamic_metadata)
except ImportError:
if self.deps == 'none':
raise # We were asked not to install deps, so bail out.
Expand Down
9 changes: 9 additions & 0 deletions tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,15 @@ def test_install_requires(self):
assert len(calls) == 1
assert calls[0]['argv'][1:5] == ['-m', 'pip', 'install', '-r']

def test_install_reqs_my_python_if_needed_pep621(self):
ins = Installer.from_ini_path(
core_samples_dir / 'pep621_nodynamic' / 'pyproject.toml',
deps='none',
)

# This shouldn't try to get version & docstring from the module
ins.install_reqs_my_python_if_needed()

def test_extras_error(self):
with pytest.raises(DependencyError):
Installer.from_ini_path(samples_dir / 'requires-requests.toml',
Expand Down

0 comments on commit e25a38e

Please sign in to comment.