编辑:似乎 setup.py 的目的是为 Mac OSX 生成一个带有py2app
. 所以现在的问题是:如何防止 snapcraft python 插件调用 setup.py?
我正在尝试为 python 应用程序创建一个 snap,既要学习 snap,又因为这个应用程序仅作为 14.04 deb 包存在,它不会安装在我最近的系统上。请注意,我对 python 很陌生,对 snaps 完全陌生...
该应用程序是来自iramuteq.org 的Iramuteq
现有的 deb 包control
文件如下所示:
Source: iramuteq
Standards-Version: 0.1.8
Section: science
Priority: extra
Maintainer: Pierre Ratinaud <[email protected]>
Build-Depends: debhelper (>= 7)
Homepage: http://www.iramuteq.org
Package: iramuteq
Architecture: all
Depends: python (>= 2.7), r-base (>= 3.0.0), python-wxgtk2.8 (>= 2.8), python-xlrd (>= 0.6), python-ooolib, r-cran-rgl (>= 0.79)
Description: Interface de R pour les analyses multidimensionnelles
所以,据我了解,我需要一些 python 库,我应该嵌入 r-cran-rgl 包。
这是snapcraft.yaml
我想出的文件:
name: iramuteq # you probably want to 'snapcraft register <name>'
version: '0.7-alpha2' # just for humans, typically '1.2+git' or '1.3.2'
summary: R INTERFACE for multidimensional analysis of texts and questionnaires # 79 char long summary
description: |
IRAMUTEQ is a GNU GPL (v2) licensed software that provides users with
statistical analysis on text corpus and tables composed by individuals/words.
It is based on R software and on python language.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
apps:
iramuteq:
command: iramuteq
parts:
iramuteq:
source: http://www.iramuteq.org/git/iramuteq
source-type: git
plugin: python
python-version: 'python2'
python-packages:
- ooolib
- xlrd
- wxgtk2.8
stage-packages:
- r-base # (>= 3.0.0)
- r-cran-rgl #(>= 0.79)
运行snapcraft
,我收到以下错误:
Processing /home/franck/iramuteq/snap/parts/iramuteq/src
Link is a directory, ignoring download_dir
Complete output from command python setup.py egg_info:
warning: no directories found matching 'doc/_static'
warning: no directories found matching 'doc/_templates'
warning: no previously-included files matching '.DS_Store' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.dSYM' found anywhere in distribution
warning: no previously-included files matching '*.dSYM/*' found anywhere in distribution
warning: no previously-included files matching '*__pycache__*' found anywhere in distribution
no previously-included directories found matching 'examples/*/build'
no previously-included directories found matching 'examples/*/dist'
no previously-included directories found matching 'examples/*/*/build'
no previously-included directories found matching 'examples/*/*/dist'
no previously-included directories found matching 'examples/*/*/*/build'
no previously-included directories found matching 'examples/*/*/*/dist'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-9UlL_H-build/setup.py", line 21, in <module>
setup_requires=['py2app'],
File "/home/franck/iramuteq/snap/parts/iramuteq/install/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/home/franck/iramuteq/snap/parts/iramuteq/install/lib/python2.7/site-packages/setuptools/dist.py", line 317, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/home/franck/iramuteq/snap/parts/iramuteq/install/lib/python2.7/site-packages/setuptools/dist.py", line 372, in fetch_build_eggs
replace_conflicting=True,
File "/home/franck/iramuteq/snap/parts/iramuteq/install/lib/python2.7/site-packages/pkg_resources/__init__.py", line 851, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/home/franck/iramuteq/snap/parts/iramuteq/install/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1123, in best_match
return self.obtain(req, installer)
File "/home/franck/iramuteq/snap/parts/iramuteq/install/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1135, in obtain
return installer(requirement)
File "/home/franck/iramuteq/snap/parts/iramuteq/install/lib/python2.7/site-packages/setuptools/dist.py", line 440, in fetch_build_egg
return cmd.easy_install(req)
File "/home/franck/iramuteq/snap/parts/iramuteq/install/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 674, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/home/franck/iramuteq/snap/parts/iramuteq/install/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 700, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/home/franck/iramuteq/snap/parts/iramuteq/install/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 881, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/home/franck/iramuteq/snap/parts/iramuteq/install/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1120, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/home/franck/iramuteq/snap/parts/iramuteq/install/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1108, in run_setup
raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: This distribution is only supported on MacOSXdistuitls error.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-9UlL_H-build/
现在,我遇到了 distutils 错误……而且我也不确定 R 是否会(应该?)嵌入到我的 snap 中,或者安装在我的主系统上。
好吧,你已经
plugin: python
用 try to run 声明了 snapcraftsetup.py
。使用另一个插件,就像make
那个项目有一个Makefile
. 顺便说一句,make
基本上是运行make; make install
但是,在执行此操作之前,请检查
debian/rules
作为 Debian 源包的 makefile 的文件。看看他们是如何真正制作上一个版本的。更新:我刚刚检查了
debian/rules
文件,它包含手动安装命令。可能适用于您的情况的选项:
dump
(或已弃用copy
)插件。否则,请帮助上游项目也
setup.py
为 GNU/Linux 工作或添加Makefile
.(可能是最佳选择)使用您喜欢的任何插件和自定义命令:插件-
prepare:
常用关键字build:
install:
建议包含所有需要的二进制文件(如 R),这样它就不会在更新和应用严格限制时中断。
回答:
是的。
如果这些包在构建时定义良好,选项 2 和 3 允许使用 R 命令安装并将它们包含在 snap 包中。
如果这些包只能在运行时安装,则将 R 设置为使用
SNAP_COMMON
或SNAP_DATA
在部署后可写。snap 将核心安装为只读。可能还有其他选择,我仍在挖掘以了解 snap 的工作原理。