我試圖通過Github項目凍結Travis CI內的Python應用程序。我成功地在Travis中通過pip
成功調用了freeze.py
實用程序的安裝,但是當我嘗試凍結它運行的Python程序時,卻沒有生成構建可執行文件所需的必要C和Makefile。凍結Travis CI上的Python應用程序
這是我.travis.yml
:
language: python
python:
- "2.7"
# Command to install dependencies
install: "pip install freeze"
# Command to build with `rake`
script: rake default
,這是我的Rakefile:
#
# Rakefile to build standalone `secho` Unix-like executable program on Travis CI.
# To build on your own system; please use `make` instead.
#
freeze = "python /home/travis/virtualenv/python2.7/lib/python2.7/site- packages/pip/commands/freeze.py"
io = "secho"
task :default => [:freeze, :compile]
task :freeze do
sh "python #{io}.py python test output - OK"
sh "#{freeze} #{io}.py" # This runs but there is no console output & nothing generated.
end
task :compile do
sh "ls"
sh "make -f Makefile"
sh "strip #{io}"
sh "rm -f Makefile *.o *.c"
sh "./#{io} compiled test output - OK"
end
task :clean do
sh "rm -f #{io}"
end
task :test do
puts "dummy test"
end
只有運行在第一個任務:freeze
與Python腳本似乎已成功完成。我做錯了什麼?
非常感謝,
山姆。
https://github.com/stpettersens/super-echo
我有點困惑。用pip作爲依賴項安裝的'freeze'包與「pip freeze」命令無關。 「pip.commands.freeze」模塊不能像你想要做的那樣作爲腳本運行。運行'pip freeze'就可以運行'sh'pip freeze''。但我不認爲這就是你想要做的。 – Iguananaut