【问题标题】:Compiling C code with python setuptools 'bdist_deb'使用 python setuptools 'bdist_deb' 编译 C 代码
【发布时间】:2017-02-03 11:15:25
【问题描述】:

我必须将我的 RPM 包转换为 DEB 包才能在 Ubuntu 上安装它。由于我没有任何构建 DEB 包的经验,因此谷歌搜索建议使用 stdeb 包中的“bdist_rpm”

代码主要是python、配置文件等。但是有一个C代码需要构建。 RPM 将二进制文件安装在 /usr/bin

setup.py 中用于创建二进制文件的代码是

if sys.argv and len(sys.argv) > 1 and sys.argv[1].strip().startswith('bdist'):
try:
    compiler = UnixCCompiler(verbose=1)
    compiler.compile(['cutility/chown_sudo.c'])
    compiler.link_executable((['cutility/chown_sudo.o']), 'bin/sudoown')
except CompileError as compileError:
    print "Failed to compile the binary file."
    raise

bdist_rpm 理解此代码并创建 C。但 bdist_deb 忽略它:(

在网上搜索,debuild 实用程序建议为这个和许多其他复杂的东西创建一些 Makefile

有那么复杂吗?一些搜索还建议使用“外星人”工具?

到目前为止我的想法是,使用以下命令

python setup.py --command-packages=stdeb.command debianize

然后调整debian目录postint、control等。 但我不知道如何构建 C 代码

【问题讨论】:

    标签: python debian deb


    【解决方案1】:

    我发现在使用“bdist_deb”选项时,我与“bdist_rpm”一起使用的“bdist”检查导致了问题。使用 'bdist_deb' 选项时,使用 'build' 参数调用脚本。在我为startswith('build')添加了一个OR之后,事情进展了

    【讨论】:

      猜你喜欢
      • 2019-08-16
      • 2011-08-09
      • 2012-03-14
      • 1970-01-01
      • 2014-09-09
      • 2015-06-06
      • 1970-01-01
      • 2022-01-18
      • 1970-01-01
      相关资源
      最近更新 更多