File: generate.rb

package info (click to toggle)
ruby-amq-protocol 2.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 476 kB
  • sloc: ruby: 5,153; python: 248; makefile: 3
file content (24 lines) | stat: -rwxr-xr-x 645 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env ruby
# encoding: utf-8

# rabbitmq-codegen is Python 3 compatible and so is
# the code in this repo but Mako still fails with 3.6 as of May 2017 :( MK.
python = ENV.fetch("PYTHON", "python2")

def sh(*args)
  system(*args)
end

extensions = []

spec = "codegen/rabbitmq-codegen/amqp-rabbitmq-0.9.1.json"
unless File.exist?(spec)
  sh "git submodule update --init"
end

path = "lib/amq/protocol/client.rb"
puts "Running '#{python} ./codegen/codegen.py client #{spec} #{extensions.join(' ')} #{path}'"
sh "#{python} ./codegen/codegen.py client #{spec} #{extensions.join(' ')} #{path}"
if File.file?(path)
  sh "ruby -c #{path}"
end