我有一个gtk+3
项目,用python3
写成文件结构(我在Linux
):
$tree
.
├── autogen.sh
├── configure.ac
├── Makefile.am
├── mkbib.desktop.in
└── src
├── __init__.py #empty file
├── menubar.ui
├── menu.py
├── mkbib.py
├── pybib.py
└── view.py
mkbib.py包含app.run()
:
$tail -5 mkbib.py
if __name__ == "__main__":
app = mkbib()
r = app.run(sys.argv)
sys.exit(r)
我正在尝试创建自动工具,如developer.gnome site
所示看起来像:
$cat configure.ac
# This file is processed by autoconf to create a configure script
AC_INIT([mkbib], [1.0],[],[mkbib])
AM_INIT_AUTOMAKE([1.10 no-define foreign dist-xz no-dist-gzip])
AC_CONFIG_FILES([Makefile mkbib.desktop])
AC_OUTPUT
$cat Makefile.am
bin_SCRIPTS = mkbib
%.desktop: %.desktop.in
desktopdir = $(datadir)/applications
desktop_DATA = mkbib.desktop
dist_noinst_DATA = mkbib.desktop.in
mkbib:src/mkbib.py
和autogen.sh是链接中给出的完整副本。
现在,如果我正在尝试运行autogen.sh(这样运行没有错误); make install,for make install,我得到了:
make install
make[1]: Entering directory '/home/rudra/Devel/mkbib/Python/Mkbib'
/usr/bin/mkdir -p '/var/tmp/bin'
/usr/bin/mkdir -p '/var/tmp/share/applications'
/usr/bin/install -c -m 644 mkbib.desktop '/var/tmp/share/applications'
make[1]: Leaving directory '/home/rudra/Devel/mkbib/Python/Mkbib'
如您所见,没有创建可执行文件mkbib
。但是,.desktop
文件放在适当的位置
如何使用autotools创建单个可执行文件?
NB:根据python的标准,我也尝试过setup.py,但that
我的情况更糟糕 LRN的回复:
与bin_SCRIPTS = src/mkbib.py
我得到了:
$make install
make[1]: Entering directory '/home/rudra/Devel/mkbib/Python/Mkbib'
/usr/bin/mkdir -p '/home/rudra/.local/bin'
/usr/bin/install -c src/mkbib.py '/home/rudra/.local/bin'
/usr/bin/mkdir -p '/home/rudra/.local/share/applications'
/usr/bin/install -c -m 644 mkbib.desktop '/home/rudra/.local/share/applications'
make[1]: Leaving directory '/home/rudra/Devel/mkbib/Python/Mkbib'
$/home/rudra/.local/bin/mkbib.py
/home/rudra/.local/bin/mkbib.py: line 9: from: command not found
/home/rudra/.local/bin/mkbib.py: line 10: syntax error near unexpected token `"Gtk",'
/home/rudra/.local/bin/mkbib.py: line 10: `gi.require_version("Gtk", "3.0")'
$python3 /home/rudra/.local/bin/mkbib.py
Traceback (most recent call last):
File "/home/rudra/.local/bin/mkbib.py", line 3, in <module>
import menu
ImportError: No module named 'menu'