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

README.md installed to /usr/README.md #972

Closed
swt2c opened this issue Mar 26, 2021 · 14 comments
Closed

README.md installed to /usr/README.md #972

swt2c opened this issue Mar 26, 2021 · 14 comments
Assignees
Labels

Comments

@swt2c
Copy link
Contributor

swt2c commented Mar 26, 2021

Hi,

When installing 1.18.10 on Fedora, README.md gets installed to /usr/README.md. Also, there's this warning from setup.py:

running install_data
warning: install_data: setup script did not provide a directory for 'README.md' -- installing right in '/builddir/build/BUILDROOT/python-PyMuPDF-1.18.10-1.fc35.x86_64/usr'
copying README.md -> /builddir/build/BUILDROOT/python-PyMuPDF-1.18.10-1.fc35.x86_64/usr

This doesn't seem like the correct location to install the README.

@JorjMcKie
Copy link
Collaborator

I started including files README.md and changes.rst in the source distribution based on request in #888.
Would you please coordinate with the issuer of #888, @jayvdb, what I should include and where?
I have no problem making any adjustments - as long as there is no moving target ...

@jayvdb
Copy link

jayvdb commented Mar 26, 2021

On openSUSE, I just delete the installed doc files as they will be handled by %doc in rpmbuild. So it doesnt matter to me where, or even if, they are installed. I only need them to be in the sdist tarball.

@JorjMcKie
Copy link
Collaborator

@jayvdb - thanks for that prompt reaction ...
@swt2c - what do you say?

@swt2c
Copy link
Contributor Author

swt2c commented Mar 26, 2021

I agree, I think we want the README.md to be in the source distribution. I would suggest not installing it by default though. Probably removing it from data_files in setup.py would be sufficient?

@JorjMcKie
Copy link
Collaborator

JorjMcKie commented Mar 26, 2021

removing it from data_files in setup.py would be sufficient?

Let me check whether setup.py sdist will let it survive ...

No: commenting out the `data files or some of its items will lead to those items being dropped from the tarball altogether. So, what should I do?

@swt2c
Copy link
Contributor Author

swt2c commented Mar 26, 2021

I believe the recommended way for controlling what goes in sdist is to use MANIFEST.in:
https://packaging.python.org/guides/using-manifest-in/

@JorjMcKie
Copy link
Collaborator

@swt2c - thank you.
Ok, I created MANIFEST.in with the following contents:

include fitz/_config.h
include changes.rst
include README.md
include PKG-INFO
include COPYING

Also modified setup.py to use setuptools instead of the outdated distutils.
Now, setup.py no longer contains a data_files argument.
The presence of README.md also no longer leads to an admonition when running python setup.py sdist.
A PyMuPDF.egg-info folder is created additionally.

After all this, the .tar.gz file has the following layout:

PyMuPDF-1.18.11.tar.gz
    PyMuPDF-1.18.11.tar
        .
        PyMuPDF-1.18.11
            fitz
                fitz.py
                fitz_wrap.c
                utils.py
                _config.h
                __init__.py
                __main__.py
            PyMuPDF.egg-info
                dependency_links.txt
                PKG-INFO
                SOURCES.txt
                top_level.txt
            changes.rst
            COPYING
            MANIFEST.in
            PKG-INFO
            README.md
            setup.cfg
            setup.py

@JorjMcKie
Copy link
Collaborator

@jayvdb / @swt2c - please confirm you are fine with this.

@swt2c
Copy link
Contributor Author

swt2c commented Mar 27, 2021

Looks good to me.

@JorjMcKie
Copy link
Collaborator

Resolved by v1.18.11 just uploaded.

@swt2c
Copy link
Contributor Author

swt2c commented Apr 17, 2021

It seems that README.md is still in data_files, though:
https://github.com/pymupdf/PyMuPDF/blob/master/setup.py#L159

Also, I don't see the MANIFEST.in in git?

@JorjMcKie
Copy link
Collaborator

@swt2c - thanks, will be corrected next version.

@swt2c
Copy link
Contributor Author

swt2c commented Sep 17, 2021

README.md is still included in data_files...

@JorjMcKie
Copy link
Collaborator

@swt2c - I have completely reworked the setup:

  • There no longer are separate long descriptions in files PKG-INFO and README.md. The long description is now identical to the content of README.md.
  • File PKG-INFO has gone completely. The setup generates this file internally from other information.
  • setup.py now uses setuptools and no longer distutils.
  • There is a new option to ease specifying MuPDF library locations: setup.py checks the presence of os.environ["PYMUPDF-DIRS"]. If found it assumes the value to be a filename containing JSON syntax like this:
{ "include_dirs": ["filename1", "filename2"], "library_dirs": ["filename3", "filename4"]}

The encountered lists are then appended to the predefined ones in setup.
Hopefully this obsoletes the need to manually modify setup.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants