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

flit install fails with IsADirectoryError #399

Closed
jepler opened this issue Mar 18, 2021 · 3 comments · Fixed by #401
Closed

flit install fails with IsADirectoryError #399

jepler opened this issue Mar 18, 2021 · 3 comments · Fixed by #401
Milestone

Comments

@jepler
Copy link

jepler commented Mar 18, 2021

Over in cascadetoml we have observed a problem where flit install fails, but flit build pip install dist/*.whl succeeds. The problem appears to be related to a folder that is intended excluded by [tool.flit.sdist] exclude = ["LICENSES"]

$ cd cascadetoml
$ git log -1 --oneline
613b71e (HEAD, tag: 0.3.0, origin/main, origin/HEAD) Split functions for use as library too
$ flit --version
Flit 3.1.0
$ flit install
Extras to install for deps 'all': {'.none'}                                                                         I-flit.install
Processing /home/jepler/src/cascadetoml
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: typer in /home/jepler/.local/lib/python3.7/site-packages (from cascadetoml==0.2.0) (0.3.2)
Requirement already satisfied: tabulate in /home/jepler/.local/lib/python3.7/site-packages (from cascadetoml==0.2.0) (0.8.6)
Requirement already satisfied: tomlkit in /home/jepler/.local/lib/python3.7/site-packages (from cascadetoml==0.2.0) (0.7.0)
Requirement already satisfied: parse in /home/jepler/.local/lib/python3.7/site-packages (from cascadetoml==0.2.0) (1.19.0)
Requirement already satisfied: click<7.2.0,>=7.1.1 in /home/jepler/.local/lib/python3.7/site-packages (from typer->cascadetoml==0.2.0) (7.1.2)
Building wheels for collected packages: cascadetoml
  Building wheel for cascadetoml (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /home/jepler/.local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpdhoys63q
       cwd: /tmp/pip-req-build-swc5y1i6
  Complete output (18 lines):
  Traceback (most recent call last):
    File "/home/jepler/.local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/home/jepler/.local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/jepler/.local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 205, in build_wheel
      metadata_directory)
    File "/tmp/pip-build-env-cww1zsoj/overlay/lib/python3.7/site-packages/flit_core/buildapi.py", line 61, in build_wheel
      info = make_wheel_in(pyproj_toml, Path(wheel_directory))
    File "/tmp/pip-build-env-cww1zsoj/overlay/lib/python3.7/site-packages/flit_core/wheel.py", line 233, in make_wheel_in
      wb.build()
    File "/tmp/pip-build-env-cww1zsoj/overlay/lib/python3.7/site-packages/flit_core/wheel.py", line 221, in build
      self.write_metadata()
    File "/tmp/pip-build-env-cww1zsoj/overlay/lib/python3.7/site-packages/flit_core/wheel.py", line 201, in write_metadata
      self._add_file(path, '%s/%s' % (self.dist_info, osp.basename(path)))
    File "/tmp/pip-build-env-cww1zsoj/overlay/lib/python3.7/site-packages/flit_core/wheel.py", line 152, in _add_file_zf36
      with open(full_path, 'rb') as src, self.wheel_zip.open(zinfo, 'w') as dst:
  IsADirectoryError: [Errno 21] Is a directory: 'LICENSES'
  ----------------------------------------
  ERROR: Failed building wheel for cascadetoml
Failed to build cascadetoml
ERROR: Could not build wheels for cascadetoml which use PEP 517 and cannot be installed directly
Traceback (most recent call last):
  File "/home/jepler/.local/bin/flit", line 8, in <module>
    sys.exit(main())
  File "/home/jepler/.local/lib/python3.7/site-packages/flit/__init__.py", line 172, in main
    pth=args.pth_file).install()
  File "/home/jepler/.local/lib/python3.7/site-packages/flit/install.py", line 415, in install
    self.install_with_pip()
  File "/home/jepler/.local/lib/python3.7/site-packages/flit/install.py", line 353, in install_with_pip
    check_call(cmd, shell=shell)
  File "/usr/lib/python3.7/subprocess.py", line 347, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', 'install', '.', '--user']' returned non-zero exit status
@takluyver
Copy link
Member

Thanks! It's assuming that any COPYING* or LICENSE* in the root of the project is a file that should be added to the wheel metadata (to catch different extensions and files with no extension). It should be easy enough to skip the directory.

@jepler
Copy link
Author

jepler commented Mar 21, 2021

Thank you!

It may be that something should still be done with the LICENSES/ directory, as this is where reuse, a tool to help comply with FSFE's "REUSE" guidelines for software licencing, places the texts of the various licenses that cover various parts of a project (since many projects end up with files covered under more than a single open source license).

Is it worth filing a separate issue about this?

@takluyver
Copy link
Member

Yes and no. I'm happy to extend what flit does with license files, but as far as I know there's no standard for where licenses should go in wheels, and I don't know of any tools that get them either from wheels or installed packages.

You might also be interested in PEP 639, an in-progress draft for more structured ways to specify license info with Python packages. There's a (rather long) discussion about that underway at https://discuss.python.org/t/pep-639-improving-license-clarity-with-better-package-metadata/2154/ .

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 a pull request may close this issue.

2 participants