Snapcraft Python2 construindo numpy com python-dev

4

apenas começando a sujar as mãos com mal-humorado. Eu estou tentando portar um projeto python para um aplicativo mal-intencionado. O código python depende do numpy 1.5.1, que depende da instalação do python-dev.

Minha seção de peças de snapcraft se parece com:

parts:
    mypythonapp:
        plugin: python2
        source: https://github.com/me/mypythonapp.git
        source-type: git
        build-packages:
            - gcc
            - gfortran
            - libblas-dev
            - liblapack-dev
            - cython
            - python-dev
        python-packages:
            - numpy==1.5.1

Quando eu snapcraft pull tenta construir numpy, mas erros com:

    x86_64-linux-gnu-gcc: build/src.linux-x86_64-2.7/numpy/core/src/npymath/ieee754.c
        In file included from numpy/core/src/npymath/ieee754.c.src:7:0:
        numpy/core/src/npymath/npy_math_common.h:4:20: fatal error: Python.h: No such file or directory
        compilation terminated.
        In file included from numpy/core/src/npymath/ieee754.c.src:7:0:
        numpy/core/src/npymath/npy_math_common.h:4:20: fatal error: Python.h: No such file or directory
        compilation terminated.

error: Command "x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -I/home/me/Code/mypythonapp-snap/parts/mypythonapp/install/usr/include -I/home/me/Code/mypythonapp-snap/parts/mypythonapp/install/usr/include -I/home/me/Code/mypythonapp-snap/parts/mypythonapp/install/usr/include/x86_64-linux-gnu -I/home/me/Code/mypythonapp-snap/parts/mypythonapp/install/usr/include -I/home/me/Code/mypythonapp-snap/parts/mypythonapp/install/usr/include -I/home/me/Code/mypythonapp-snap/parts/mypythonapp/install/usr/include/x86_64-linux-gnu -fPIC -Inumpy/core/include -Ibuild/src.linux-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -Ibuild/src.linux-x86_64-2.7/numpy/core/src/multiarray -Ibuild/src.linux-x86_64-2.7/numpy/core/src/umath -c build/src.linux-x86_64-2.7/numpy/core/src/npymath/ieee754.c -o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/numpy/core/src/npymath/ieee754.o"

Eu posso encontrar Python.h localizado em ./parts/mypythonapp/install/usr/include/python2.7/Python.h . Quando olho para todos os caminhos incluídos, percebo que usr/include/python2.7 não está lá.

Existe alguma maneira para eu incluir um caminho similar ao configflags do plugin automático? Ou estou sentindo falta de algo fácil?

editar : Fiz alguns progressos ao modificar a função env no plug-in python2 localizado em /usr/lib/python3/dist-packages/snapcraft/plugins/python2.py

A função original parecia:

  def env(self, root):
    # This is until we figure out how to get pip to download only
    # and then build in the build step or split out pulling
    # stage-packages in an internal private step.
    env = [
        'CPPFLAGS="-I{} $CPPFLAGS"'.format(os.path.join(
            root, 'usr', 'include')),
        'CFLAGS="-I{} $CFLAGS"'.format(os.path.join(
            root, 'usr', 'include')),
    ]

Eu modifiquei para parecer:

def env(self, root):
    # This is until we figure out how to get pip to download only
    # and then build in the build step or split out pulling
    # stage-packages in an internal private step.
    env = [
        'CPPFLAGS="-I{} $CPPFLAGS"'.format(os.path.join(
            root, 'usr', 'include')),
        'CFLAGS="-I{} $CFLAGS"'.format(os.path.join(
            root, 'usr', 'include')),
        'CPPFLAGS="-I{} $CPPFLAGS"'.format(os.path.join(
            root, 'usr', 'include', 'python2.7')),
        'CFLAGS="-I{} $CFLAGS"'.format(os.path.join(
            root, 'usr', 'include' 'python2.7')),
    ]

Agora, ele pega o Python.h , mas não consegue encontrar scalartypes.c

x86_64-linux-gnu-gcc: numpy/core/src/multiarray/multiarraymodule_onefile.c
    numpy/core/src/multiarray/multiarraymodule_onefile.c:10:25: fatal error: scalartypes.c: No such file or directory
    compilation terminated.
    numpy/core/src/multiarray/multiarraymodule_onefile.c:10:25: fatal error: scalartypes.c: No such file or directory
    compilation terminated.
    
por gblanchard4 27.04.2016 / 18:40

0 respostas