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


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

Re: packaging help request: paths for build_py and build_scripts phases

From Timo Röhling <roehling@debian.org>
Newsgroups linux.debian.maint.python
Subject Re: packaging help request: paths for build_py and build_scripts phases
Date 2021-10-18 18:20 +0200
Message-ID <D9DwL-4QN-19@gated-at.bofh.it> (permalink)
References <D9xKF-1cl-5@gated-at.bofh.it>
Organization The Debian Project

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi Jonathan,

* Jonathan Dowland <jmtd@debian.org> [2021-10-18 11:04]:
>Here, the scripts are copied to a path *not* rooted in <<PKGBUILDDIR>>.
>So far as I can tell, both phases are normal parts of the
>setuptools/distutils build lifecycle, and I haven't spotted anything
>obviously non-standard about the way that is specified.
>[...]
>A BTS bug requesting the new version with some back-and-forth trying to
>figure this out is
>https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=988597

The main issue is the implicit upstream assumption that the tests
are run from the source root dir; I've had a similar problem with
tweepy and my solution was to make sure that the tests find
everything they need in the build folder, i.e. add the following
snippet to d/rules:

export PYBUILD_BEFORE_TEST=cp {dir}/trash-* {dir}/script/bump.py {build_dir}
export PYBUILD_AFTER_TEST=rm {build_dir}/trash-* {build_dir}/bump.py

The second line is needed so the extraneous stuff is not installed
with the built package. It's not very pretty, and hopefully someone
else has a better solution, but it gets the job done.

You'll also have to patch tests/run_command.py to run python3 and
add python3-psutils to your Build-Depends.


diff --git a/tests/run_command.py b/tests/run_command.py
index 2e31e11..746cdad 100644
--- a/tests/run_command.py
+++ b/tests/run_command.py
@@ -17,7 +17,7 @@ def run_command(cwd, command, args=None, input='', env=None):
      if args == None:
          args = []
      command_full_path = os.path.join(base_dir, command)
-    process = subprocess.Popen(["python", command_full_path] + args,
+    process = subprocess.Popen(["python3", command_full_path] + args,
                                 stdin=subprocess.PIPE,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE,


Cheers
Timo

PS. I worked around the missing fork
PPS. I thought about patching run_command.py to use the scripts from
  the source directory, but that will use the trashcli module from the
  source tree, not from the build tree, and contaminate the source tree
  with __pycache__ folders.

-- 
⢀⣴⠾⠻⢶⣦⠀   ╭────────────────────────────────────────────────────╮
⣾⠁⢠⠒⠀⣿⡁   │ Timo Röhling                                       │
⢿⡄⠘⠷⠚⠋⠀   │ 9B03 EBB9 8300 DF97 C2B1  23BF CC8C 6BDD 1403 F4CA │
⠈⠳⣄⠀⠀⠀⠀   ╰────────────────────────────────────────────────────╯

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


Thread

packaging help request: paths for build_py and build_scripts phases Jonathan Dowland <jmtd@debian.org> - 2021-10-18 12:10 +0200
  Re: packaging help request: paths for build_py and build_scripts  phases Timo Röhling <roehling@debian.org> - 2021-10-18 18:20 +0200

csiph-web