0

我有一个用文件结构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 站点中所示

看起来像:

$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
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文件放置在适当的位置

如何使用自动工具创建单个可执行文件?

注意:根据 python 的标准,我也尝试过 setup.py 但我失败得更糟

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'
4

0 回答 0