Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.maint.python > #9681

RE:building manpages via setup.py

Path csiph.com!feeder.erje.net!2.eu.feeder.erje.net!news.szaf.org!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From PICCA Frederic-Emmanuel <frederic-emmanuel.picca@synchrotron-soleil.fr>
Newsgroups linux.debian.maint.python
Subject RE:building manpages via setup.py
Date Thu, 03 Aug 2017 12:20:01 +0200
Message-ID <ualot-6Yh-21@gated-at.bofh.it> (permalink)
References <u9GEH-5cQ-19@gated-at.bofh.it> <u9Hr4-5Jr-23@gated-at.bofh.it> <u9WzM-6Xn-23@gated-at.bofh.it> <u9Wgq-6Qo-9@gated-at.bofh.it>
X-Original-To Piotr Ożarowski <piotr@debian.org>, "debian-python@lists.debian.org" <debian-python@lists.debian.org>
X-Mailbox-Line From debian-python-request@lists.debian.org Thu Aug 3 10:15:20 2017
Old-Return-Path <frederic-emmanuel.picca@synchrotron-soleil.fr>
X-Amavis-Spam-Status No, score=-0.1 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, THREADTOPIC=2] autolearn=no autolearn_force=no
X-Policyd-Weight using cached result; rate: -6.1
Dkim-Filter OpenDKIM Filter v2.10.3 brouette.synchrotron-soleil.fr 159007000E3
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=synchrotron-soleil.fr; s=email; t=1501754220; bh=N8ryoVhB76X1TddEZ2uD6+HOtcKTsYtzrH1GL86Ypek=; h=From:To:Subject:Date:References:In-Reply-To:From; b=kcptuqSvI4k7YrM95cQolMY+sE3coPn8ieISQ/Z+4lgu8sCcU4o0kcjGyN8q43BEV q9FuPUZjadza4TOtguNUHF9sHDEHwo+N1+be+WZGcxs8jijNa0NzW82KluY+h2XN27 9m36gVcVSdCrEfmNnu1zwGyjdoj8DxRBhXeLgXsM=
Dkim-Filter OpenDKIM Filter v2.10.3 brouette.synchrotron-soleil.fr 3718F700093
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=synchrotron-soleil.fr; s=email; t=1501754219; bh=N8ryoVhB76X1TddEZ2uD6+HOtcKTsYtzrH1GL86Ypek=; h=From:To:Subject:Date:References:In-Reply-To:From; b=kmsKZWzIyU46mksKM+h78Wj5rgf7mitHKA93tAmEMRNO6RttyZaL+W6n2eCBCxBee d8f/fZCB82lbroWqH+X0/BBxsZ4I068hsGEfu2w/5eUS8wiUSIZJuuGmDWovz21YUZ tziZj+tAoqYkPTo3LKqZFVr7YqlafuAIL0zbdBKg=
Thread-Topic building manpages via setup.py
Thread-Index AdMKnYeNbtHGA2ChRMa/5+FgMHXlSAALU42AACRWRyD//+WzAIAB3eYl
Accept-Language fr-FR, en-US
Content-Language fr-FR
X-Originating-IP [195.221.0.171]
Content-Type text/plain; charset="iso-8859-2"
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-Mailing-List <debian-python@lists.debian.org> archive/latest/15062
List-ID <debian-python.lists.debian.org>
List-URL <https://lists.debian.org/debian-python/>
List-Archive https://lists.debian.org/msgid-search/A2A20EC3B8560D408356CAC2FC148E53BB3FA0F5@SUN-DAG3.synchrotron-soleil.fr
Approved robomod@news.nic.it
Lines 128
Organization linux.* mail to news gateway
Sender robomod@news.nic.it
X-Original-Date Thu, 3 Aug 2017 09:56:58 +0000
X-Original-Message-ID <A2A20EC3B8560D408356CAC2FC148E53BB3FA0F5@SUN-DAG3.synchrotron-soleil.fr>
X-Original-References <A2A20EC3B8560D408356CAC2FC148E53BB3F8A26@SUN-DAG3.synchrotron-soleil.fr> <20170801153401.6aqaw4syh3pvzchb@sar0.p1otr.com> <A2A20EC3B8560D408356CAC2FC148E53BB3F9C43@SUN-DAG3.synchrotron-soleil.fr>,<20170802072020.3nwvcsvoly4vycit@sar0.p1otr.com> <20170802072020.3nwvcsvoly4vycit@sar0.p1otr.com>
Xref csiph.com linux.debian.maint.python:9681

Show key headers only | View raw


Hello Piotr,

I am struggling, with the build system.

I will speak about this solution

> | override_dh_auto_build:
> |       dh_auto_build -- --after-build '{interpreter} setup.py build_man'

the code instrumented of the BuildMan is this one

class BuildMan(Command):
    """Command to build man pages"""
    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        build = self.get_finalized_command('build')
        path = sys.path
        path.insert(0, os.path.abspath(build.build_lib))

        print("PYTHONPATH", os.environ.get("PYTHONPATH", None))
        print("sys.path", sys.path, os.path.exists(build.build_lib))
        env = dict((str(k), str(v)) for k, v in os.environ.items())
        env["PYTHONPATH"] = os.pathsep.join(path)
        print("env[PYTHONPATH]", env["PYTHONPATH"])

        import subprocess

        status = subprocess.call(["mkdir", "-p", "build/man"])
        if status != 0:
            raise RuntimeError("Fail to create build/man directory")

        try:
            import tempfile
            import stat
            script_name = None

            # help2man expect a single executable file to extract the help
            # we create it, execute it, and delete it at the end

            # create a launcher using the right python interpreter
            script_fid, script_name = tempfile.mkstemp(prefix="%s_" % PROJECT, text=True)
            script = os.fdopen(script_fid, 'wt')
            script.write("#!%s\n" % sys.executable)
            script.write("import runpy\n")
            script.write("runpy.run_module('%s', run_name='__main__')\n" % PROJECT)
            script.close()

            # make it executable
            mode = os.stat(script_name).st_mode
            os.chmod(script_name, mode + stat.S_IEXEC)

            # execute help2man
            p = subprocess.Popen(["help2man", script_name, "-o", "build/man/silx.1"], env=env)
            status = p.wait()
            if status != 0:
                raise RuntimeError("Fail to generate man documentation")
        finally:
            # clean up the script
            if script_name is not None:
                os.remove(script_name)


When I run the build it generate a pydistconfig file wit this content

D: pybuild plugin_distutils:55: pydistutils config file:
[clean]
all=1
[build]
build-lib=/home/picca/Debian/silx/silx/.pybuild/pythonX.Y_2.7/build
[install]
force=1
install-layout=deb
install-scripts=/usr/bin
install-lib=/usr/lib/python2.7/dist-packages
[easy_install]
allow_hosts=None


But when it comes to the --after step, I get this output

('PYTHONPATH', '/home/picca/Debian/silx/silx/.pybuild/pythonX.Y_2.7/build')
('sys.path', ['/home/picca/Debian/silx/silx/build/lib.linux-i386-2.7', '/home/picca/Debian/silx/silx', '/home/picca/Debian/silx/silx/.pybuild/pythonX.Y_2.7/build', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-i386-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7'], False)
('env[PYTHONPATH]', '/home/picca/Debian/silx/silx/build/lib.linux-i386-2.7:/home/picca/Debian/silx/silx:/home/picca/Debian/silx/silx/.pybuild/pythonX.Y_2.7/build:/usr/lib/python2.7:/usr/lib/python2.7/plat-i386-linux-gnu:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload:/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages/PILcompat:/usr/lib/python2.7/dist-packages/gtk-2.0:/usr/lib/pymodules/python2.7')

So as you can see the path returned by build.build_lib
seems to be

/home/picca/Debian/silx/silx/build/lib.linux-i386-2.7'

and not

/home/picca/Debian/silx/silx/.pybuild/pythonX.Y_2.7/build (provided via pydist)

So my question is what is wrong.

self.get_finalized_command('build')

doesn not take into account the pydistconfig file ?


Thanks for your help


Frederic

Back to linux.debian.maint.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

building manpages via setup.py PICCA Frederic-Emmanuel <frederic-emmanuel.picca@synchrotron-soleil.fr> - 2017-08-01 16:50 +0200
  Re: building manpages via setup.py Ghislain Vaillant <ghisvail@gmail.com> - 2017-08-01 17:00 +0200
    RE:building manpages via setup.py PICCA Frederic-Emmanuel <frederic-emmanuel.picca@synchrotron-soleil.fr> - 2017-08-01 17:50 +0200
  Re: building manpages via setup.py Piotr Ożarowski <piotr@debian.org> - 2017-08-01 17:40 +0200
    RE:building manpages via setup.py PICCA Frederic-Emmanuel <frederic-emmanuel.picca@synchrotron-soleil.fr> - 2017-08-02 09:20 +0200
      Re: building manpages via setup.py Piotr Ożarowski <piotr@debian.org> - 2017-08-02 09:30 +0200
        Re: building manpages via setup.py Piotr Ożarowski <piotr@debian.org> - 2017-08-02 09:50 +0200
          Re: building manpages via setup.py Ghislain Vaillant <ghisvail@gmail.com> - 2017-08-02 09:50 +0200
            Re: building manpages via setup.py Ghislain Vaillant <ghisvail@gmail.com> - 2017-08-02 10:20 +0200
              RE:building manpages via setup.py PICCA Frederic-Emmanuel <frederic-emmanuel.picca@synchrotron-soleil.fr> - 2017-08-02 10:40 +0200
                Re: building manpages via setup.py Ghislain Vaillant <ghisvail@gmail.com> - 2017-08-02 10:40 +0200
                RE:building manpages via setup.py PICCA Frederic-Emmanuel <frederic-emmanuel.picca@synchrotron-soleil.fr> - 2017-08-02 11:20 +0200
                Re: building manpages via setup.py Ghislain Vaillant <ghisvail@gmail.com> - 2017-08-02 11:30 +0200
                RE:building manpages via setup.py PICCA Frederic-Emmanuel <frederic-emmanuel.picca@synchrotron-soleil.fr> - 2017-08-02 12:10 +0200
                Re: building manpages via setup.py Ghislain Vaillant <ghisvail@gmail.com> - 2017-08-02 12:50 +0200
                RE:building manpages via setup.py PICCA Frederic-Emmanuel <frederic-emmanuel.picca@synchrotron-soleil.fr> - 2017-08-02 14:30 +0200
            RE:building manpages via setup.py PICCA Frederic-Emmanuel <frederic-emmanuel.picca@synchrotron-soleil.fr> - 2017-08-02 10:30 +0200
        RE:building manpages via setup.py PICCA Frederic-Emmanuel <frederic-emmanuel.picca@synchrotron-soleil.fr> - 2017-08-02 09:50 +0200
        RE:building manpages via setup.py PICCA Frederic-Emmanuel <frederic-emmanuel.picca@synchrotron-soleil.fr> - 2017-08-03 12:20 +0200
          RE:building manpages via setup.py PICCA Frederic-Emmanuel <frederic-emmanuel.picca@synchrotron-soleil.fr> - 2017-08-03 15:50 +0200
            RE:building manpages via setup.py PICCA Frederic-Emmanuel <frederic-emmanuel.picca@synchrotron-soleil.fr> - 2017-08-03 16:20 +0200

csiph-web