2017-02-03 69 views
1

我必须将我的RPM软件包转换为DEB软件包才能在Ubuntu上安装它。由于我没有任何构建DEB包的经验,因此使用Google搜索建议从stdeb包中'bdist_rpm'使用python setuptools'bdist_deb'编译C代码

代码主要是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,控制等 但我不知道如何建立的C代码

回答

0

我原来,我在'bdist_rpm'中使用的'bdist'检查在使用'bdist_deb'选项时引起了问题。当使用'bdist_deb'选项时,该脚本被调用'build'参数。在我为startswith('build')添加OR之后,事情发展了