如何将 Gnome 小程序与 distutils 捆绑在一起?
我正在尝试用 Python 编写一个 Gnome 小程序。事实上,我已经编写了该应用程序,但在打包它时我陷入了困境。
我首先研究 distutils。我立即遇到的问题是,在指定 py_modules 时,需要使用 .py 扩展名。然而,Gnome 小程序基本上是 shell 脚本。 (当然,使用 Python 解释器。)
这是我尝试过的......但它不起作用。
from distutils.core import setup
setup(name='myapp',
version='1.2',
py_modules=['myapp'],
)
此外,myapp
文件必须放入/usr/lib/myapp/
中。据我所知,distutils 将文件与其他模块放在一起。
我该怎么做呢?
I'm trying to write a Gnome applet in Python. In fact, I've written the app and I'm stuck when it comes to packaging it.
I started by looking into distutils. The problem I ran into right away was that when specifying py_modules
, an extension of .py
is expected. However, Gnome applets are basically shell scripts. (That use the Python interpreter, of course.)
Here is what I tried... but it isn't working.
from distutils.core import setup
setup(name='myapp',
version='1.2',
py_modules=['myapp'],
)
Also, the myapp
file has to get put in /usr/lib/myapp/
. As far as I know, distutils
puts the files in with the other modules.
How should I go about doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
脚本应使用
distutils.core.setup()
的script
选项安装,如distutils
文档。另一方面,py_modules
用于列出各个模块,并且它们必须具有您所描述的.py
扩展名。另外,如果您想添加其他文件,
data_files< /code> 选项
允许您指定文件的源和目标。
答案摘要:阅读整个
distutils
文档。Scripts should be installed with the
script
option todistutils.core.setup()
as described indistutils
documentation. On the other hand,py_modules
is used to list individual modules, and they must have.py
extension as you described.Also, if you want to add additional files, the
data_files
option lets you specify both source and destination of the files.Answer summary: Read whole
distutils
documentation.