bugnano / rnr

The RNR File Manager (RNR's Not Ranger)
GNU General Public License v3.0
52 stars 1 forks source link

Include missing files in sdist #2

Closed thatch closed 4 years ago

thatch commented 4 years ago

Include missing files in sdist for #1

Tested with

+++ mktemp -d
++ D=/tmp/tmp.kIj5FN46t0
++ trap 'rm -rf /tmp/tmp.kIj5FN46t0' EXIT
++ python -m venv /tmp/tmp.kIj5FN46t0
++ python setup.py sdist -d /tmp/tmp.kIj5FN46t0
running sdist
running egg_info
creating rnr.egg-info
writing rnr.egg-info/PKG-INFO
writing dependency_links to rnr.egg-info/dependency_links.txt
writing entry points to rnr.egg-info/entry_points.txt
writing requirements to rnr.egg-info/requires.txt
writing top-level names to rnr.egg-info/top_level.txt
writing manifest file 'rnr.egg-info/SOURCES.txt'
reading manifest file 'rnr.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'rnr.egg-info/SOURCES.txt'
running check
creating rnr-0.2.0
creating rnr-0.2.0/doc
creating rnr-0.2.0/rnr
creating rnr-0.2.0/rnr.egg-info
copying files to rnr-0.2.0...
copying MANIFEST.in -> rnr-0.2.0
copying README.md -> rnr-0.2.0
copying requirements.txt -> rnr-0.2.0
copying rnr.fish -> rnr-0.2.0
copying rnr.sh -> rnr-0.2.0
copying setup.py -> rnr-0.2.0
copying doc/rnr.1 -> rnr-0.2.0/doc
copying rnr/__init__.py -> rnr-0.2.0/rnr
copying rnr/__main__.py -> rnr-0.2.0/rnr
copying rnr/bookmarks.py -> rnr-0.2.0/rnr
copying rnr/buttonbar.py -> rnr-0.2.0/rnr
copying rnr/cmdbar.py -> rnr-0.2.0/rnr
copying rnr/config.py -> rnr-0.2.0/rnr
copying rnr/database.py -> rnr-0.2.0/rnr
copying rnr/debug_print.py -> rnr-0.2.0/rnr
copying rnr/dlg_cpmv.py -> rnr-0.2.0/rnr
copying rnr/dlg_cpmv_progress.py -> rnr-0.2.0/rnr
copying rnr/dlg_delete_progress.py -> rnr-0.2.0/rnr
copying rnr/dlg_dirscan.py -> rnr-0.2.0/rnr
copying rnr/dlg_error.py -> rnr-0.2.0/rnr
copying rnr/dlg_question.py -> rnr-0.2.0/rnr
copying rnr/dlg_report.py -> rnr-0.2.0/rnr
copying rnr/fallocate.py -> rnr-0.2.0/rnr
copying rnr/panel.py -> rnr-0.2.0/rnr
copying rnr/rnr_cpmv.py -> rnr-0.2.0/rnr
copying rnr/rnr_delete.py -> rnr-0.2.0/rnr
copying rnr/rnr_dirscan.py -> rnr-0.2.0/rnr
copying rnr/utils.py -> rnr-0.2.0/rnr
copying rnr.egg-info/PKG-INFO -> rnr-0.2.0/rnr.egg-info
copying rnr.egg-info/SOURCES.txt -> rnr-0.2.0/rnr.egg-info
copying rnr.egg-info/dependency_links.txt -> rnr-0.2.0/rnr.egg-info
copying rnr.egg-info/entry_points.txt -> rnr-0.2.0/rnr.egg-info
copying rnr.egg-info/requires.txt -> rnr-0.2.0/rnr.egg-info
copying rnr.egg-info/top_level.txt -> rnr-0.2.0/rnr.egg-info
Writing rnr-0.2.0/setup.cfg
Creating tar archive
removing 'rnr-0.2.0' (and everything under it)
++ cd /
++ /tmp/tmp.kIj5FN46t0/bin/pip install /tmp/tmp.kIj5FN46t0/rnr-0.2.0.tar.gz
Processing /tmp/tmp.kIj5FN46t0/rnr-0.2.0.tar.gz
Collecting urwid (from rnr==0.2.0)
  Downloading https://files.pythonhosted.org/packages/45/dd/d57924f77b0914f8a61c81222647888fbb583f89168a376ffeb5613b02a6/urwid-2.1.0.tar.gz (630kB)
Collecting fuzzyfinder (from rnr==0.2.0)
  Downloading https://files.pythonhosted.org/packages/6c/80/e23249f1119435d00d0a226debbb0390de4b6ad456c1939de94512b946c8/fuzzyfinder-2.1.0-py2.py3-none-any.whl
Collecting atomicwrites (from rnr==0.2.0)
  Downloading https://files.pythonhosted.org/packages/2c/a0/da5f49008ec6e9a658dbf5d7310a4debd397bce0b4db03cf8a410066bb87/atomicwrites-1.4.0-py2.py3-none-any.whl
Collecting pyxdg (from rnr==0.2.0)
  Downloading https://files.pythonhosted.org/packages/39/03/12eb9062f43adb94e30f366743cb5c83fd15fef026500cd4de42c7c12280/pyxdg-0.26-py2.py3-none-any.whl (40kB)
Installing collected packages: urwid, fuzzyfinder, atomicwrites, pyxdg, rnr
  Running setup.py install for urwid: started
    Running setup.py install for urwid: finished with status 'done'
  Running setup.py install for rnr: started
    Running setup.py install for rnr: finished with status 'done'
Successfully installed atomicwrites-1.4.0 fuzzyfinder-2.1.0 pyxdg-0.26 rnr-0.2.0 urwid-2.1.0
WARNING: You are using pip version 19.2.3, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
++ echo Success
Success
+++ rm -rf /tmp/tmp.kIj5FN46t0
bugnano commented 4 years ago

Thank you for this contribution.

Before merging, I would just change a couple of things:

In the same way that import is not a good practice, I think that including .txt and *.md isn't a good practice either, what do you think?

As the setup.py references explicitly README.md and requirements.txt, I would explicitly use those instead.

As you know more about setuptools than me, can you tell me if on line 13 of setup.py, where I generate the man page from the AsciiDoc source, is it the best place to put it or not?

I mean, when building a wheel from the sdist package, is the setup.py file used or not? because if it is, then this means that we need the asciidoc toolchain, and also the rnr.1.adoc file in the sdist. On the other hand, if the setup.py file is not used for building the wheel, then we're good as we are now.

thatch commented 4 years ago

In the same way that import is not a good practice, I think that including .txt and *.md isn't a good practice either, what do you think?

I agree with you, if you were to add a test that confirms this works. Otherwise, using a glob is slightly less likely to break if you do have other files in the future (like requirements-dev.txt or so). I have a few hundred of these to wrangle, so I've left on "allow edits from maintainers" and would recommend you edit to suit.

As you know more about setuptools than me, can you tell me if on line 13 of setup.py, where I generate the man page from the AsciiDoc source, is it the best place to put it or not?

Depends on when you want it to happen. Do you want it included in the sdist too, or only the wheel? I sould recommend looking at https://docs.python.org/3/distutils/extending.html (and some real-world examples in grpc -- https://github.com/grpc/grpc/blob/9facfe2b684bbaaf9e75e2d285e7bffceeefe2b1/src/python/grpcio/commands.py#L107 and the necessary cmdclass stuff in setup.py). What you have -- doing stuff at setup.py import time -- is surprisingly common, and with my practical hat on I think you can leave it if these other options seem overly complicated.

bugnano commented 4 years ago

OK, I changed the MANIFEST.in, in order to explicitly add the required files.

By reading the setuptools documentation, it looks like the README.md file is already included by default, without the need for a MAINFEST.in file.

I left the include README.md line in MANIFEST.in, just to be explicit, so that each open() call in setup.py has a matching include line in MANIFEST.in