2017-11-10 103 views
0

试图创建python应用(非法入侵)的snap包。我已经将它上传到pypi,并且它在Arch和Ubuntu上安装,奇怪的是Arch上的/ usr/bin/trespass和Ubuntu上的/ usr/local/bin/trespass。寻找帮助创建Snap包

当我尝试构建它时,它会失败。

这是我第一次pypi包和第一次尝试。所以很有可能我做错了,提前谢谢。

这里是拱

[[email protected] trespass]$ tree 
. 
├── build 
│   ├── lib 
│   │   └── trespass 
│   │    └── trespass.py 
│   └── scripts-3.6 
│    ├── trespass 
│    └── trespass.py 
├── dist 
│   ├── trespass-0.6.5.4.tar.gz 
│   └── trespass-0.6.5.5.tar.gz 
├── License 
├── MANIFEST 
├── README.md 
├── README.txt 
├── setup.cfg 
├── setup.py 
└── trespass 
    └── trespass 

dev目录我的setup.py看起来像这样

from distutils.core import setup 
setup(
    name = 'trespass', 
    packages = ['trespass'], # this must be the same as the name above 
    install_requires=[ 
    'numpy', 
    'pygpgme', 
    'pyperclip', 
    'argparse', 
    ], 
    version = '0.6.5.5', 
    description = 'A secure password keeper', 
    author = 'Graham Smith', 
    author_email = '[email protected]', 
    scripts = ['trespass/trespass'], 
    license='GPL3', 
    url = 'https://github.com/gps1539/trespass', # use the URL to the github repo 
    download_url = 'https://github.com/gps1539/trespass/archive/0.1.tar.gz', 
    keywords = ['testing', 'logging', 'example'], # arbitrary keywords 
    classifiers = [], 
) 

在Ubuntu我snapcraft.yaml看起来是这样的。

name: trespass 
version: '0.6.5.4' 
summary: A secure command line password keeper using gpg 
description: | 

grade: devel 
confinement: devmode 

apps: 
    trespass: 
    command: usr/bin/trespass 

parts: 
    trespass: 
    plugin: python 
    python-version: python3 
    source: https://github.com/gps1539/trespass/archive/0.1.tar.gz 
    build-packages: 
     - python3-gpgme 
     - python3-numpy 
     - python3-pyperclip 

当我尝试建立我得到以下输出

[email protected]:~/trespass-snap/snap# sudo snapcraft clean 
Cleaning up priming area 
Cleaning up staging area 
Cleaning up parts directory 
[email protected]:~/trespass-snap/snap# sudo snapcraft 
Preparing to pull trespass 
Hit http://us.archive.ubuntu.com/ubuntu artful InRelease        
Get:1 http://security.ubuntu.com/ubuntu artful-security InRelease [76.7 kB]   
Get:2 http://us.archive.ubuntu.com/ubuntu artful-updates InRelease [78.6 kB]   
Hit http://us.archive.ubuntu.com/ubuntu artful-backports InRelease     
Fetched 155 kB in 0s (0 B/s)               
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/libpython3.6-minimal_3.6.3-1ubuntu1_amd64.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/libsqlite3-0_3.19.3-3_amd64.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/libpython3.6-stdlib_3.6.3-1ubuntu1_amd64.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/gcc-7-base_7.2.0-8ubuntu3_amd64.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/python3.6_3.6.3-1ubuntu1_amd64.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/python3_3.6.3-0ubuntu2_amd64.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/mime-support_3.60ubuntu1_all.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/libmpdec2_2.4.2-1_amd64.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/libexpat1_2.2.3-1_amd64.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/python3.6-minimal_3.6.3-1ubuntu1_amd64.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/python3-minimal_3.6.3-0ubuntu2_amd64.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/libpython3-stdlib_3.6.3-0ubuntu2_amd64.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/dh-python_2.20170125_all.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/libreadline7_7.0-0ubuntu2_amd64.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/libffi6_3.2.1-6_amd64.deb 
Ignoring already existing file: /home/graham/.cache/snapcraft/stage-packages/apt/66f26b5c7004236fca9a758cf1145e852e35e7324ed76a2004e35368186a7648fc1d800421527a152edbd60f41ffd05d/var/cache/apt/archives/libssl1.0.0_1.0.2g-1ubuntu13.2_amd64.deb 
Pulling trespass 
Downloading '0.1.tar.gz'|                
The directory '/home/graham/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
The directory '/home/graham/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
Collecting pip 
    Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB) 
    100% |████████████████████████████████| 1.3MB 733kB/s 
    Saved ./parts/trespass/packages/pip-9.0.1-py2.py3-none-any.whl 
Collecting setuptools 
    Downloading setuptools-36.7.0-py2.py3-none-any.whl (482kB) 
    100% |████████████████████████████████| 491kB 1.8MB/s 
    Saved ./parts/trespass/packages/setuptools-36.7.0-py2.py3-none-any.whl 
Collecting wheel 
    Downloading wheel-0.30.0-py2.py3-none-any.whl (49kB) 
    100% |████████████████████████████████| 51kB 3.2MB/s 
    Saved ./parts/trespass/packages/wheel-0.30.0-py2.py3-none-any.whl 
Successfully downloaded pip setuptools wheel 
The directory '/home/graham/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
The directory '/home/graham/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
Collecting pip 
Collecting setuptools 
Collecting wheel 
Installing collected packages: pip, setuptools, wheel 
Successfully installed pip-9.0.1 setuptools-36.7.0 wheel-0.30.0 
The directory '/home/graham/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
Preparing to build trespass 
Building trespass 
The directory '/home/graham/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
The directory '/home/graham/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
Collecting pip 
Collecting setuptools 
Collecting wheel 
Installing collected packages: pip, setuptools, wheel 
Successfully installed pip-9.0.1 setuptools-36.7.0 wheel-0.30.0 
The directory '/home/graham/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
Staging trespass 
Priming trespass 
Traceback (most recent call last): 
    File "/usr/bin/snapcraft", line 11, in <module> 
    load_entry_point('snapcraft==2.34+17.10', 'console_scripts', 'snapcraft')() 
    File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 564, in load_entry_point 
    return get_distribution(dist).load_entry_point(group, name) 
    File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2662, in load_entry_point 
    return ep.load() 
    File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2316, in load 
    return self.resolve() 
    File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2322, in resolve 
    module = __import__(self.module_name, fromlist=['__name__'], level=0) 
    File "/usr/lib/python3/dist-packages/snapcraft/cli/__main__.py", line 19, in <module> 
    run(prog_name='snapcraft') 
    File "/usr/lib/python3/dist-packages/click/core.py", line 722, in __call__ 
    return self.main(*args, **kwargs) 
    File "/usr/lib/python3/dist-packages/click/core.py", line 697, in main 
    rv = self.invoke(ctx) 
    File "/usr/lib/python3/dist-packages/click/core.py", line 1043, in invoke 
    return Command.invoke(self, ctx) 
    File "/usr/lib/python3/dist-packages/click/core.py", line 895, in invoke 
    return ctx.invoke(self.callback, **ctx.params) 
    File "/usr/lib/python3/dist-packages/click/core.py", line 535, in invoke 
    return callback(*args, **kwargs) 
    File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func 
    return f(get_current_context(), *args, **kwargs) 
    File "/usr/lib/python3/dist-packages/snapcraft/cli/__init__.py", line 110, in run 
    ctx.forward(lifecyclecli.commands['snap']) 
    File "/usr/lib/python3/dist-packages/click/core.py", line 553, in forward 
    return self.invoke(cmd, **kwargs) 
    File "/usr/lib/python3/dist-packages/click/core.py", line 535, in invoke 
    return callback(*args, **kwargs) 
    File "/usr/lib/python3/dist-packages/snapcraft/cli/lifecycle.py", line 132, in snap 
    project_options, directory=directory, output=output) 
    File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 349, in snap 
    execute('prime', project_options) 
    File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 130, in execute 
    _Executor(config, project_options).run(step, part_names) 
    File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 228, in run 
    self._create_meta(step, part_names) 
    File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle.py", line 269, in _create_meta 
    self.config.snapcraft_yaml_path) 
    File "/usr/lib/python3/dist-packages/snapcraft/internal/meta.py", line 84, in create_snap_packaging 
    packaging.write_snap_yaml() 
    File "/usr/lib/python3/dist-packages/snapcraft/internal/meta.py", line 111, in write_snap_yaml 
    snap_yaml = self._compose_snap_yaml() 
    File "/usr/lib/python3/dist-packages/snapcraft/internal/meta.py", line 276, in _compose_snap_yaml 
    snap_yaml['apps'] = self._wrap_apps(self._config_data['apps']) 
    File "/usr/lib/python3/dist-packages/snapcraft/internal/meta.py", line 385, in _wrap_apps 
    self._wrap_app(app, apps[app]) 
    File "/usr/lib/python3/dist-packages/snapcraft/internal/meta.py", line 392, in _wrap_app 
    app[k] = self._wrap_exe(app[k], '{}-{}'.format(k, name)) 
    File "/usr/lib/python3/dist-packages/snapcraft/internal/meta.py", line 365, in _wrap_exe 
    with open(exepath, 'rb') as exefile: 
FileNotFoundError: [Errno 2] No such file or directory: '/home/graham/trespass-snap/snap/prime/usr/bin/trespass' 

原胎在这里,但snapcraft论坛块的话题,由于太多的联系 https://forum.snapcraft.io/t/how-to-call-dependencies-in-snapcraft-yaml/2726/8

+0

你在哪里有setup.py?它没有在https://github.com/gps1539/trespass/archive/0.1.tar.gz – elopio

+0

发现。我需要创建一个更新标签。现在它解决了这个问题,但由于缺少头文件 – user192749

+0

Side Note gpgme.h在Ubuntu上缺失,必须添加libgpgme-dev而不是python3-gpgme,现在安装pygpgme。 – user192749

回答