tools.linux.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philippe Blain <levraiphilippeblain@gmail.com>
To: tools@linux.kernel.org
Cc: konstantin@linuxfoundation.org
Subject: [PATCH b4 4/4] Distribute the manpage with the pip package
Date: Thu, 12 Nov 2020 10:21:34 -0500	[thread overview]
Message-ID: <20201112152134.96498-5-levraiphilippeblain@gmail.com> (raw)
In-Reply-To: <20201112152134.96498-1-levraiphilippeblain@gmail.com>

The 'data_files' option to setuptools.setup can be used to install
additional files "outside" of the package [1].

Use it so that the manpage is installed with the package.

Install the manpage to '$PREFIX/share/man/man5', mimicking what the
Filesystem Hiararchy Standard mandates for the '/usr/local/' prefix [2].

Prefer '$PREFIX/share/man/man5' to '$PREFIX/man/man5' since the later is
deprecated [3].

[1] https://docs.python.org/3/distutils/setupscript.html#installing-additional-files
[2] https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s11.html#idm236091648080
[3] https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s11.html#ftn.idm236091648080

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---

Notes:
    A small note: by installing the man page to '$PREFIX/share/man', we are
    unfortunately trusting every other package installed in '$PREFIX' to follow
    the same convention.
    
    The reason is that when invoking `man <cmd>`, man(1) looks for the <cmd> man
    page by searching for man directories "near" the directory where <cmd> is found
    in 'PATH'. This search is limited to a single "nearby" directory and at least
    for some versions of man on some Linux distributions [1], '$PREFIX/man' is
    preferred to '$PREFIX/share/man'.
    
    So if manpages exist in both locations, man will only look in '$PREFIX/man' and
    our manpage won't be found. The behavior of man(1) on macOS is the opposite;
    the search prefers '$PREFIX/share/man' to '$PREFIX/man' [2].
    
    We could install the man page at both locations, but then we are wasting disk
    space (does it matter?). We can't easily use a symlink from one location to the
    other one, because this is not well supported by pip/setuptools [3].
    
    [1] https://github.com/conda-forge/git-feedstock/pull/65#discussion_r322762265
    [2] https://github.com/conda-forge/git-feedstock/issues/66#issuecomment-539095424
    [3] https://github.com/pypa/pip/issues/5856

 setup.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/setup.py b/setup.py
index 65ede59..867b5cf 100644
--- a/setup.py
+++ b/setup.py
@@ -38,6 +38,7 @@ setup(
     license='GPLv2+',
     long_description=read('man/b4.5.rst'),
     long_description_content_type='text/x-rst',
+    data_files = [('share/man/man5', ['man/b4.5'])],
     keywords=['git', 'lore.kernel.org', 'patches'],
     install_requires=[
         'requests'
-- 
2.27.0


  parent reply	other threads:[~2020-11-12 15:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 15:21 [PATCH b4 0/4] Add the man page to the pip package Philippe Blain
2020-11-12 15:21 ` [PATCH b4 1/4] Add '.venv' to .gitignore Philippe Blain
2020-11-12 15:21 ` [PATCH b4 2/4] Link to the README from PyPI Philippe Blain
2020-11-12 15:21 ` [PATCH b4 3/4] Add pointers to https://linux.kernel.org/g/tools Philippe Blain
2020-11-12 15:21 ` Philippe Blain [this message]
2020-11-17 21:05 ` [PATCH b4 0/4] Add the man page to the pip package Konstantin Ryabitsev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201112152134.96498-5-levraiphilippeblain@gmail.com \
    --to=levraiphilippeblain@gmail.com \
    --cc=konstantin@linuxfoundation.org \
    --cc=tools@linux.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).