unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Alexis Simon via Guix-Science <guix-science@gnu.org>
To: Simon Tournier <zimon.toutoune@gmail.com>,
	help-guix <help-guix@gnu.org>,
	 guix-science@gnu.org
Subject: Re: packaging python-cyvcf2
Date: Fri, 22 Mar 2024 12:38:41 -0700	[thread overview]
Message-ID: <7b845ef7-f15e-45b9-9a31-e645ce736ec4@runbox.com> (raw)
Message-ID: <20240322193841.K_DHUqx-tDHS_JZDmw705Tp9TdflgjdeYxSM0cWdrI8@z> (raw)
In-Reply-To: <87il1eb867.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3332 bytes --]


On 22/03/2024 08:25, Simon Tournier wrote:
> Hi,
> 
> On jeu., 21 mars 2024 at 18:03, Alexis Simon via Guix-Science <guix-science@gnu.org> wrote:
> 
>> The build is failing with this error:
>> running build_ext
>> # cyvcf2: htslib mode is BUILTIN
>> # cyvcf2: htslib configure options is None
>> error: [Errno 2] No such file or directory: './configure'
>> error: in phase 'build': uncaught exception:
>> %exception #<&invoke-error program: "python" arguments: ("./setup.py"
>> "build") exit-status: 1 term-signal: #f stop-signal: #f>
>>
>> What is very disturbing is that it builds fine in a debugging
>> environment following the documentation [2]
> 
> Indeed!  Well, another undocumented trick. ;-)
> 
>          guix build -L . python-cyvcf2 \
>               --with-source=python-cyvcf2=/tmp/cyvcf2-0.30.28
> 
> where /tmp/cyvcf2-0.30.28 is the uncompressed output of “guix build -S”
> that I tweak.  Adding this:
> 
> --8<---------------cut here---------------start------------->8---
> diff -u /tmp/guix-build-python-cyvcf2-0.30.28.drv-0/cyvcf2-0.30.28/setup.py /tmp/cyvcf2-0.30.28/setup.py
> --- /tmp/guix-build-python-cyvcf2-0.30.28.drv-0/cyvcf2-0.30.28/setup.py	2024-01-30 17:46:32.000000000 +0100
> +++ /tmp/cyvcf2-0.30.28/setup.py	2024-03-22 16:15:28.124301350 +0100
> @@ -83,7 +83,13 @@
>           if htslib_configure_options:
>               configure_args.extend(htslib_configure_options.split())
>   
> -        subprocess.run(configure_args, check=True)
> +        print(configure_args,
> +              "File exists?", os.path.exists(configure_args[0]),
> +              flush=True)
> +        try:
> +            subprocess.run(configure_args, check=True)
> +        except:
> +            print("BANG!")
>       subprocess.run(["make"], check=True)
>   
>       os.chdir(current_directory)
> --8<---------------cut here---------------end--------------->8---
> 
> It leads to this output:
> 
> --8<---------------cut here---------------start------------->8---
> running build_ext
> # cyvcf2: htslib mode is BUILTIN
> # cyvcf2: htslib configure options is None
> ['./configure', 'CFLAGS=-fPIC'] File exists? True
> echo '# Default htscodecs.mk generated by Makefile' > htscodecs.mk
> echo 'include $(HTSPREFIX)htscodecs_bundled.mk' >> htscodecs.mk
> ./hts_probe_cc.sh 'gcc' '-g -Wall -O2 -fvisibility=hidden ' '-fvisibility=hidden' >> htscodecs.mk
> /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/sh: line 1: ./hts_probe_cc.sh: No such file or directory
> Makefile:141: htscodecs.mk: No such file or directory
> make: *** [Makefile:124: htscodecs.mk] Error 127
> BANG!
> Traceback (most recent call last):
> [...]
> --8<---------------cut here---------------end--------------->8---
> 
> Arf, then I have not investigated further.
> 
> I think it does not come from ’./configure’ as wrongly reported but from
> something triggered by it.
> 
> Let me know your progress.  Maybe I could give a closer look next week.

Thanks a lot for the trick, I was able to finish compiling it, but going 
another route (i.e. unbundling htslib).

I've abandoned running the tests though, I'm hitting a module not found 
error. pytest doesn't manage to load the just built module, probably an 
issue with the paths.

I'm attaching the new version for reference.

Cheers,
Alexis

> 
> Cheers,
> simon
> 

[-- Attachment #2: cyvcf2.scm --]
[-- Type: text/x-scheme, Size: 3137 bytes --]

(define-module (cyvcf2)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages build-tools)
  #:use-module (gnu packages cmake)
  #:use-module (gnu packages check)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-build)
  #:use-module (gnu packages python-check)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages python-science)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages bioinformatics)
  #:use-module (gnu packages serialization)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages tls)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix utils)
  #:use-module (guix build-system python)
  #:use-module (guix build-system cargo)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system pyproject))

(define-public python-cyvcf2
  (package
    (name "python-cyvcf2")
    (version "0.30.28")
    (source
     (origin
        (method git-fetch)
        (uri (git-reference
              (url "https://github.com/brentp/cyvcf2")
              (commit (string-append "v" version))))
        (sha256
          (base32 "16yhfax509zyip8kkq2b0lflx5bdq5why7d785ayrqyzzq2rxqkk"))
        (modules '((guix build utils)))
        (snippet
         '(begin
            (delete-file-recursively "htslib")))))
    (build-system pyproject-build-system)
    (arguments
     `(#:tests? #f
       #:phases
        (modify-phases %standard-phases
          ; (add-before 'check 'rm-folder
          ;   (lambda _
          ;           (copy-recursively "cyvcf2/tests" "./tests")
          ;           (delete-file-recursively "cyvcf2")
          ;           (mkdir-p "cyvcf2")
          ;           (copy-recursively "tests" "cyvcf2/tests")))
          (add-after 'unpack 'fix-setup
             (lambda* (#:key inputs #:allow-other-keys)
                     (substitute* "setup.py"
                                  ((" or not check_libhts\\(\\)") "")
                                  (("library_dirs=htslib_library_dirs")
                                   (string-append "library_dirs=[\"" (assoc-ref inputs "htslib") "/lib\"]"))
                                  (("\\+ htslib_include_dirs")
                                   (string-append "+ [\"" (assoc-ref inputs "htslib") "/include\"]")))))
          (add-before 'build 'setenv
             (lambda _
                     (setenv "CYTHONIZE" "1")
                     (setenv "CYVCF2_HTSLIB_MODE" "EXTERNAL"))))))
    (inputs (list htslib zlib libdeflate curl openssl python-cython))
    (native-inputs (list python-pytest))
    (propagated-inputs (list python-click
                             python-coloredlogs
                             python-numpy))
    (home-page "https://github.com/brentp/cyvcf2/")
    (synopsis "fast vcf parsing with cython + htslib")
    (description "fast vcf parsing with cython + htslib")
    (license license:expat)))


  reply	other threads:[~2024-03-22 21:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22  1:03 packaging python-cyvcf2 Alexis Simon
2024-03-22  1:03 ` Alexis Simon via Guix-Science
2024-03-22 15:25 ` Simon Tournier
2024-03-22 19:38   ` Alexis Simon [this message]
2024-03-22 19:38     ` Alexis Simon via Guix-Science
2024-03-26 15:47     ` Simon Tournier
2024-04-18  9:13     ` Ricardo Wurmus
2024-04-21  1:31       ` Alexis Simon via Guix-Science

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=7b845ef7-f15e-45b9-9a31-e645ce736ec4@runbox.com \
    --to=guix-science@gnu.org \
    --cc=alexis.simon@runbox.com \
    --cc=help-guix@gnu.org \
    --cc=zimon.toutoune@gmail.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).