rearchitect as a gem
embedding Ruby in C did not go so well
This commit is contained in:
1 parent
9188bb42e2
commit
432bd7458e
19 files changed
+136
-559
No files matched your search
+8
-3
@@ -1,3 +1,8 @@
|
||||
/.lock-waf*
|
||||
/.waf*
|
||||
/build/
|
||||
/.bundle/
|
||||
/.yardoc
|
||||
/_yardoc/
|
||||
/coverage/
|
||||
/doc/
|
||||
/pkg/
|
||||
/spec/reports/
|
||||
/tmp/
|
||||
@@ -0,0 +1,4 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
# Specify your gem's dependencies in svi.gemspec
|
||||
gemspec
|
||||
@@ -0,0 +1,20 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
svi (0.1.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
rake (10.4.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
bundler (~> 1.10)
|
||||
rake (~> 10.0)
|
||||
svi!
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.6
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 Josh Holtrop
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -1,19 +0,0 @@
|
||||
.PHONY: build
|
||||
build:
|
||||
./waf "$@"
|
||||
|
||||
.PHONY: distclean
|
||||
distclean:
|
||||
./waf "$@"
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
./waf "$@"
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
./waf "$@"
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
./waf "$@"
|
||||
@@ -0,0 +1,41 @@
|
||||
# Svi
|
||||
|
||||
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/svi`. To experiment with that code, run `bin/console` for an interactive prompt.
|
||||
|
||||
TODO: Delete this and the text above, and describe your gem
|
||||
|
||||
## Installation
|
||||
|
||||
Add this line to your application's Gemfile:
|
||||
|
||||
```ruby
|
||||
gem 'svi'
|
||||
```
|
||||
|
||||
And then execute:
|
||||
|
||||
$ bundle
|
||||
|
||||
Or install it yourself as:
|
||||
|
||||
$ gem install svi
|
||||
|
||||
## Usage
|
||||
|
||||
TODO: Write usage instructions here
|
||||
|
||||
## Development
|
||||
|
||||
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
||||
|
||||
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
||||
|
||||
## Contributing
|
||||
|
||||
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/svi.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
require_relative "svi/svn_runner"
|
||||
require_relative "svi/version"
|
||||
|
||||
module Svi
|
||||
# Your code goes here...
|
||||
end
|
||||
File renamed without changes.
@@ -0,0 +1,3 @@
|
||||
module Svi
|
||||
VERSION = "0.1.0"
|
||||
end
|
||||
@@ -1,9 +0,0 @@
|
||||
begin
|
||||
load "#{$SHARE_DIR}/lib/svi.rb"
|
||||
rescue Interrupt => e
|
||||
rescue Exception => e
|
||||
$stderr.puts "#{e.class}: #{e}"
|
||||
e.backtrace.each do |entry|
|
||||
$stderr.puts "> #{entry}"
|
||||
end
|
||||
end
|
||||
@@ -1,12 +0,0 @@
|
||||
$LOAD_PATH.unshift("#{$SHARE_DIR}/lib")
|
||||
require "yawpa"
|
||||
require_relative "svi/svn_runner"
|
||||
|
||||
module Svi
|
||||
class << self
|
||||
def run(args)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Svi.run($ARGS)
|
||||
@@ -1,202 +0,0 @@
|
||||
require "yawpa/version"
|
||||
|
||||
# Yet Another Way to Parse Arguments is an argument-parsing library for Ruby.
|
||||
#
|
||||
# Yawpa does not try to provide a fancy DSL.
|
||||
# It does not require you to define a class or inherit from a class.
|
||||
# it just provides a simple functional interface for parsing options,
|
||||
# supporting subcommands and arbitrary numbers of arguments for each option.
|
||||
#
|
||||
# Features:
|
||||
# - POSIX or non-POSIX mode (supports subcommands using POSIX mode)
|
||||
# - Options can require an arbitrary number of parameters
|
||||
# - Options can be defined with a range specifying the allowed number of
|
||||
# parameters
|
||||
module Yawpa
|
||||
|
||||
# Exception class raised when an unknown option is observed.
|
||||
class ArgumentParsingException < Exception; end
|
||||
|
||||
class << self
|
||||
|
||||
# Parse input parameters looking for options according to rules given in
|
||||
# flags.
|
||||
# Syntax:
|
||||
# opts, args = parse(params, options, flags = {})
|
||||
#
|
||||
# An ArgumentParsingException will be raised if an unknown option is
|
||||
# observed or insufficient arguments are present for an option.
|
||||
#
|
||||
# Example +options+:
|
||||
#
|
||||
# {
|
||||
# version: nil,
|
||||
# verbose: {short: 'v'},
|
||||
# server: {nargs: (1..2)},
|
||||
# username: {nargs: 1},
|
||||
# password: {nargs: 1},
|
||||
# color: :boolean,
|
||||
# }
|
||||
#
|
||||
# The keys of the +options+ Hash can be either strings or symbols.
|
||||
#
|
||||
#
|
||||
# @param params [Array]
|
||||
# List of program parameters to parse.
|
||||
# @param options [Hash]
|
||||
# Hash containing the long option names as keys, and values containing
|
||||
# special flags for the options as values (examples above).
|
||||
# Possible values:
|
||||
# +nil+:: No special flags for this option (equivalent to +{}+)
|
||||
# +:boolean+::
|
||||
# The option is a toggleable boolean option (equivalent to
|
||||
# +{boolean: true}+)
|
||||
# Hash::
|
||||
# Possible option flags:
|
||||
# - +:short+: specify a short option letter to associate with the long
|
||||
# option
|
||||
# - +:nargs+: specify an exact number or range of possible numbers of
|
||||
# arguments to the option
|
||||
# - +:boolean+: if true, specify that the option is a toggleable
|
||||
# boolean option and allow a prefix of "no" to turn it off.
|
||||
# @param flags [Hash]
|
||||
# Optional flags dictating how {.parse} should do its job.
|
||||
# @option flags [Boolean] :posix_order
|
||||
# Stop processing parameters when a non-option argument is seen.
|
||||
# Set this to +true+ if you want to implement subcommands.
|
||||
#
|
||||
# @return [Array]
|
||||
# Two-element array containing +opts+ and +args+ return values.
|
||||
# +opts+::
|
||||
# The returned +opts+ value will be a Hash with the observed
|
||||
# options as keys and any option arguments as values.
|
||||
# +args+::
|
||||
# The returned +args+ will be an Array of the unprocessed
|
||||
# parameters (if +:posix_order+ was passed in +flags+, this array might
|
||||
# contain further options that were not processed after observing a
|
||||
# non-option parameters).
|
||||
def parse(params, options, flags = {})
|
||||
options = _massage_options(options)
|
||||
opts = {}
|
||||
args = []
|
||||
i = 0
|
||||
while i < params.length
|
||||
param = params[i]
|
||||
if param =~ /^--([^=]+)(?:=(.+))?$/
|
||||
param_name, val = $1, $2
|
||||
bool_val = true
|
||||
if options[param_name].nil?
|
||||
if param_name =~ /^no(.*)$/
|
||||
test_param_name = $1
|
||||
if options[test_param_name]
|
||||
param_name = test_param_name
|
||||
bool_val = false
|
||||
end
|
||||
end
|
||||
end
|
||||
opt_config = options[param_name]
|
||||
raise ArgumentParsingException.new("Unknown option '#{param_name}'") unless opt_config
|
||||
param_key = opt_config[:key]
|
||||
if opt_config[:boolean]
|
||||
opts[param_key] = bool_val
|
||||
elsif opt_config[:nargs].last == 0
|
||||
opts[param_key] = true
|
||||
else
|
||||
opts[param_key] = []
|
||||
i += _gather(opt_config[:nargs], i + 1, params, val, param_key, opts[param_key])
|
||||
end
|
||||
elsif param =~ /^-(.+)$/
|
||||
short_flags = $1
|
||||
short_idx = 0
|
||||
while short_idx < short_flags.length
|
||||
opt_config = _find_opt_config_by_short_name(options, short_flags[short_idx])
|
||||
if opt_config.nil?
|
||||
raise ArgumentParsingException.new("Unknown option '-#{short_flags[short_idx]}'")
|
||||
end
|
||||
param_key = opt_config[:key]
|
||||
if opt_config[:nargs].last == 0
|
||||
opts[param_key] = true
|
||||
else
|
||||
opts[param_key] = []
|
||||
i += _gather(opt_config[:nargs],
|
||||
i + 1,
|
||||
params,
|
||||
short_flags[short_idx + 1, short_flags.length],
|
||||
param_key,
|
||||
opts[param_key])
|
||||
break
|
||||
end
|
||||
short_idx += 1
|
||||
end
|
||||
elsif flags[:posix_order]
|
||||
args = params[i, params.length].map(&:dup)
|
||||
break
|
||||
else
|
||||
args << params[i].dup
|
||||
end
|
||||
i += 1
|
||||
end
|
||||
|
||||
# Condense 1-element arrays of option values to just the element itself
|
||||
opts.each_key do |k|
|
||||
if opts[k].is_a?(Array) and opts[k].length == 1
|
||||
opts[k] = opts[k].first
|
||||
end
|
||||
end
|
||||
|
||||
return [opts, args]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Internal helper method to gather arguments for an option
|
||||
def _gather(nargs, start_idx, params, initial, param_key, result)
|
||||
n_gathered = 0
|
||||
if initial and initial != ''
|
||||
result << initial
|
||||
n_gathered += 1
|
||||
end
|
||||
num_indices_used = 0
|
||||
index = start_idx
|
||||
while n_gathered < nargs.last and
|
||||
index < params.length and
|
||||
params[index][0] != '-' do
|
||||
result << params[index].dup
|
||||
index += 1
|
||||
num_indices_used += 1
|
||||
n_gathered += 1
|
||||
end
|
||||
if n_gathered < nargs.first
|
||||
raise ArgumentParsingException.new("Not enough arguments supplied for option '#{param_key}'")
|
||||
end
|
||||
num_indices_used
|
||||
end
|
||||
|
||||
# Internal helper method to format the options in a consistent format
|
||||
def _massage_options(options)
|
||||
{}.tap do |newopts|
|
||||
options.each_pair do |k, v|
|
||||
v = {} if v.nil?
|
||||
v = {boolean: true} if v == :boolean
|
||||
newkey = k.to_s
|
||||
newopts[newkey] = {key: k}
|
||||
nargs = v[:nargs] || 0
|
||||
nargs = (nargs..nargs) if nargs.is_a?(Integer)
|
||||
newopts[newkey][:nargs] = nargs
|
||||
newopts[newkey][:short] = v[:short] || ''
|
||||
newopts[newkey][:boolean] = v[:boolean]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Internal helper method to find an option configuration by short name
|
||||
def _find_opt_config_by_short_name(options, short_name)
|
||||
options.each_pair do |k, v|
|
||||
return v if v[:short] == short_name
|
||||
end
|
||||
nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
module Yawpa
|
||||
# gem version
|
||||
VERSION = "1.3.0"
|
||||
end
|
||||
-120
@@ -1,120 +0,0 @@
|
||||
#include <ruby.h>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
VALUE svi_ruby_protect_eval_string_rescue(VALUE exception, VALUE exception_object)
|
||||
{
|
||||
*(bool *)exception = true;
|
||||
fprintf(stderr, "Unhandled exception: %s\n",
|
||||
rb_obj_classname(exception_object));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
VALUE svi_ruby_protect_eval_string(const char * ruby_expression, bool * exception)
|
||||
{
|
||||
*exception = false;
|
||||
return rb_rescue((VALUE(*)(...))rb_eval_string, (VALUE)ruby_expression,
|
||||
(VALUE(*)(...))svi_ruby_protect_eval_string_rescue, (VALUE)exception);
|
||||
}
|
||||
|
||||
static char * read_file(const char * filename)
|
||||
{
|
||||
int fd = ::open(filename, O_RDONLY, 0);
|
||||
if (fd < 0)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
off_t size = ::lseek(fd, 0, SEEK_END);
|
||||
if (size <= 0)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
::lseek(fd, 0, SEEK_SET);
|
||||
char * buffer = new char[size];
|
||||
off_t n_bytes_read = 0u;
|
||||
for (;;)
|
||||
{
|
||||
off_t rd_size = ::read(fd, &buffer[n_bytes_read], size - n_bytes_read);
|
||||
if (rd_size <= 0)
|
||||
break;
|
||||
n_bytes_read += rd_size;
|
||||
if (n_bytes_read >= size)
|
||||
break;
|
||||
}
|
||||
::close(fd);
|
||||
if (n_bytes_read == size)
|
||||
{
|
||||
return buffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete[] buffer;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
std::string get_exe_path()
|
||||
{
|
||||
pid_t pid = getpid();
|
||||
char proc_path[25];
|
||||
sprintf(proc_path, "/proc/%d/exe", pid);
|
||||
char exe_path[100];
|
||||
ssize_t n = readlink(proc_path, exe_path, sizeof(exe_path));
|
||||
if ((n > 0) && (n < (ssize_t)sizeof(exe_path)))
|
||||
{
|
||||
return exe_path;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static std::string share_dir;
|
||||
|
||||
const char * read_bootstrap_file()
|
||||
{
|
||||
auto exe_path = get_exe_path();
|
||||
size_t index = exe_path.rfind('/');
|
||||
if ((index != std::string::npos) && (index > 0u))
|
||||
{
|
||||
index = exe_path.rfind('/', index - 1u);
|
||||
if (index != std::string::npos)
|
||||
{
|
||||
share_dir = std::string(exe_path, 0u, index) + "/share/svi";
|
||||
char * bootstrap = read_file((share_dir + "/lib/bootstrap.rb").c_str());
|
||||
if (bootstrap != nullptr)
|
||||
{
|
||||
return bootstrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
share_dir = SHARE_DIR;
|
||||
return read_file(SHARE_DIR "/lib/bootstrap.rb");
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
bool exception = false;
|
||||
const char * ruby_startup = read_bootstrap_file();
|
||||
if (ruby_startup == nullptr)
|
||||
{
|
||||
fprintf(stderr, "Could not read Ruby startup file\n");
|
||||
return 1;
|
||||
}
|
||||
{
|
||||
RUBY_INIT_STACK;
|
||||
ruby_init();
|
||||
rb_gv_set("$SHARE_DIR", rb_str_new(share_dir.c_str(), share_dir.size()));
|
||||
VALUE argv_ruby_value = rb_ary_new();
|
||||
rb_gv_set("$ARGS", argv_ruby_value);
|
||||
for (int i = 0; i < argc; i++)
|
||||
{
|
||||
rb_ary_push(argv_ruby_value, rb_str_new_cstr(argv[i]));
|
||||
}
|
||||
svi_ruby_protect_eval_string(ruby_startup, &exception);
|
||||
}
|
||||
delete[] ruby_startup;
|
||||
return exception ? 1 : 0;
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
# coding: utf-8
|
||||
lib = File.expand_path('../lib', __FILE__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require 'svi/version'
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = "svi"
|
||||
spec.version = Svi::VERSION
|
||||
spec.authors = ["Josh Holtrop"]
|
||||
spec.email = ["jholtrop@gmail.com"]
|
||||
|
||||
spec.summary = %q{TODO: Write a short summary, because Rubygems requires one.}
|
||||
spec.description = %q{TODO: Write a longer description or delete this line.}
|
||||
spec.homepage = "TODO: Put your gem's website or public repo URL here."
|
||||
spec.license = "MIT"
|
||||
|
||||
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
||||
# delete this section to allow pushing this gem to any host.
|
||||
if spec.respond_to?(:metadata)
|
||||
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
||||
else
|
||||
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
||||
end
|
||||
|
||||
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
||||
spec.bindir = "exe"
|
||||
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
||||
spec.require_paths = ["lib"]
|
||||
|
||||
spec.add_development_dependency "bundler", "~> 1.10"
|
||||
spec.add_development_dependency "rake", "~> 10.0"
|
||||
end
|
||||
@@ -1,169 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# encoding: ISO8859-1
|
||||
# Thomas Nagy, 2005-2016
|
||||
|
||||
"""
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
"""
|
||||
|
||||
import os, sys, inspect
|
||||
|
||||
VERSION="1.8.19"
|
||||
REVISION="886d9b5813e0debe701577920d3d2c10"
|
||||
GIT="x"
|
||||
INSTALL=''
|
||||
C1='#.'
|
||||
C2='#,'
|
||||
C3='#*'
|
||||
cwd = os.getcwd()
|
||||
join = os.path.join
|
||||
|
||||
|
||||
WAF='waf'
|
||||
def b(x):
|
||||
return x
|
||||
if sys.hexversion>0x300000f:
|
||||
WAF='waf3'
|
||||
def b(x):
|
||||
return x.encode()
|
||||
|
||||
def err(m):
|
||||
print(('\033[91mError: %s\033[0m' % m))
|
||||
sys.exit(1)
|
||||
|
||||
def unpack_wafdir(dir, src):
|
||||
f = open(src,'rb')
|
||||
c = 'corrupt archive (%d)'
|
||||
while 1:
|
||||
line = f.readline()
|
||||
if not line: err('run waf-light from a folder containing waflib')
|
||||
if line == b('#==>\n'):
|
||||
txt = f.readline()
|
||||
if not txt: err(c % 1)
|
||||
if f.readline() != b('#<==\n'): err(c % 2)
|
||||
break
|
||||
if not txt: err(c % 3)
|
||||
txt = txt[1:-1].replace(b(C1), b('\n')).replace(b(C2), b('\r')).replace(b(C3), b('\x00'))
|
||||
|
||||
import shutil, tarfile
|
||||
try: shutil.rmtree(dir)
|
||||
except OSError: pass
|
||||
try:
|
||||
for x in ('Tools', 'extras'):
|
||||
os.makedirs(join(dir, 'waflib', x))
|
||||
except OSError:
|
||||
err("Cannot unpack waf lib into %s\nMove waf in a writable directory" % dir)
|
||||
|
||||
os.chdir(dir)
|
||||
tmp = 't.bz2'
|
||||
t = open(tmp,'wb')
|
||||
try: t.write(txt)
|
||||
finally: t.close()
|
||||
|
||||
try:
|
||||
t = tarfile.open(tmp)
|
||||
except:
|
||||
try:
|
||||
os.system('bunzip2 t.bz2')
|
||||
t = tarfile.open('t')
|
||||
tmp = 't'
|
||||
except:
|
||||
os.chdir(cwd)
|
||||
try: shutil.rmtree(dir)
|
||||
except OSError: pass
|
||||
err("Waf cannot be unpacked, check that bzip2 support is present")
|
||||
|
||||
try:
|
||||
for x in t: t.extract(x)
|
||||
finally:
|
||||
t.close()
|
||||
|
||||
for x in ('Tools', 'extras'):
|
||||
os.chmod(join('waflib',x), 493)
|
||||
|
||||
if sys.hexversion<0x300000f:
|
||||
sys.path = [join(dir, 'waflib')] + sys.path
|
||||
import fixpy2
|
||||
fixpy2.fixdir(dir)
|
||||
|
||||
os.remove(tmp)
|
||||
os.chdir(cwd)
|
||||
|
||||
try: dir = unicode(dir, 'mbcs')
|
||||
except: pass
|
||||
try:
|
||||
from ctypes import windll
|
||||
windll.kernel32.SetFileAttributesW(dir, 2)
|
||||
except:
|
||||
pass
|
||||
|
||||
def test(dir):
|
||||
try:
|
||||
os.stat(join(dir, 'waflib'))
|
||||
return os.path.abspath(dir)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
def find_lib():
|
||||
src = os.path.abspath(inspect.getfile(inspect.getmodule(err)))
|
||||
base, name = os.path.split(src)
|
||||
|
||||
#devs use $WAFDIR
|
||||
w=test(os.environ.get('WAFDIR', ''))
|
||||
if w: return w
|
||||
|
||||
#waf-light
|
||||
if name.endswith('waf-light'):
|
||||
w = test(base)
|
||||
if w: return w
|
||||
err('waf-light requires waflib -> export WAFDIR=/folder')
|
||||
|
||||
dirname = '%s-%s-%s' % (WAF, VERSION, REVISION)
|
||||
for i in (INSTALL,'/usr','/usr/local','/opt'):
|
||||
w = test(i + '/lib/' + dirname)
|
||||
if w: return w
|
||||
|
||||
#waf-local
|
||||
dir = join(base, (sys.platform != 'win32' and '.' or '') + dirname)
|
||||
w = test(dir)
|
||||
if w: return w
|
||||
|
||||
#unpack
|
||||
unpack_wafdir(dir, src)
|
||||
return dir
|
||||
|
||||
wafdir = find_lib()
|
||||
sys.path.insert(0, wafdir)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
from waflib import Scripting
|
||||
Scripting.waf_entry_point(cwd, VERSION, wafdir)
|
||||
|
||||
#==>
|
||||
#BZh91AY&SY"hœÕP÷ÿÿ°#*Óÿÿÿÿÿÿÿÿÿÿÿ„ Y�Âc%H4�#*`(b|÷yn�#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*¯1L õ¦Ü¹©öÒí°Õ6ÐííÝÍÝ÷ŒµÜ[Ý×_G»Ý’í¥IÝÙÞ»¤yÝÛîÑÚ—·Q°E>^ú}É©g]S©‡IbH>’{µì=´çwkBv×¶ëZ½çnw½OZéŠï£ï¾ncîîëß}óF·N}Vï7`vÛ�ß{ß'púÖ.ñ½§mmÞû7îæ»½p§Þùï#*#*#*P#*æÍ#*Àô[ ùÑC€+ܘ¹€UÖu lÚMc»\o»f€[(P«{ÞÝ:=í-€UeSm)Š`m…ì5PQ"ª#.%Ov⧬PT�’H#*•%wsŠ«ÞáÍ^ÌwÙª®�l={ÒÜž¹é¨LNÁŽÊéÔ�Þö}ö´ñÍZO¥2ï�»‡ÙÝ�žíö7ß[]vo±‰vùÝÝÛÎwݾnï�ݾͲöÜÛ�}Ÿ]÷Ø7wmîËÕ÷Ï}Ìqô#*Û[`UÐ5l§²E#,h#,(³;w¹ïnïQ½‡^�ƒïr¢Ém*7žñ]áèŠ%TFš¯cE=QO@ï{vš)mpÛ¬9uÛ›=ঌ<²]Ï·3㸶=uØeÎàµn�>=Ά›yÝÙZݤj»>ÑÚW½#*y»¹ïù^ît½ç{§__5Ó_}ƒŸ}œú(iW¶wßxyöu÷žîõuÎÛJžîï»îËË»Îïo;Mvîï½{]ïv¶Þï\½^í×ÛÜÔ{gwN,éön÷t®#,Ýêî7œ�·ÛqKZ}޼°õ³æ4iôrx›í&Ûs를YÛÝéã╲Û[o™¸Ûã=Ö$wÛ¯¹¹}w·»Ûw‰�ôïjÒºõÌ[Ýôkï8}ÎÞÏϽï7{O$öù:Àëß|îùßAöùóÞ.³�àèÐ4Ê=±R�@Ù©N›€Je'Þéâ¡ë¯xÜözÈ,ÆKwYê÷uáì»\tç^íÏf¢;«Ù*#,zô»îëÑï€#*g»Ž¤#*Aïxå»w“Ëëï{i«µôûºÛ½ï¯N/£ï{ôG¹÷²öë¤'q®º<©ë�³ÝÎòöÛní9#,×b!Þ÷�[ÜÛ6Î/|ùÁöÞöø½mÕ¯}áÒõ&÷õw‡ÓÝ—Ùs^‡Ý©5ôsÛxžûϽ×u—…·wÏn½Ç‹9XöíÜ>7¶Þîâùö}õ¾w·i7Û{|íæ1€6´P}ÜnÏZzx>íëØï…Ëu ×Û Ñx¾Z]ê¶Û;÷´û¹Þ–û#*`(•Hª—×{£W¯ußnŽ½ÎžñÒ½ëi½Öl}²Þ¯¾øwJ¾øîvêÛÝç{�Æùè/»å¹öãèí´¬”#,#*zÝeìh{op®µ®õ�н5‹œQ£Ó½æ÷‡Ý†�&€AyŽöîk¡×¼èŽMg�å}ò'·¸¾ì€™AZ÷žzûï¸ïº€C¯mËr®ÎØÏOkŽjªÎßtöÙ9Ý·QvÈ#.I#wgkwtO.¦ó9©feôî“6}wÓ'ª+Öšnwzêëã‡}ò�Ý`í½:n˜’iÑÓ½·smãŽÑ�n{Ý|½ÜÚÛv�ä©>÷¹7ÛjÒ�·]•æ×†§.íŽGßnš@€2#*™4#*� &ši‘ 4##Bž‘?JÒd4�d¤oE¦�A4#*‰„Ñ©Oa#,Éâ£Ó(¡ê #*#*#*#* ‘@šÄÐMÂ&)<F”óOUÒ&ž#Qµ#*H#*#*Ð#*#*ž©E$Ѩ#*#@ôzSõ&M=!êi¦€ÐÑ Ð#*jhh#*#*Ð#*#*I #*Ð ¡1OCM=SO ž£FPÐz�P#*#*#*#*j"#*! �#*L‰èÔi=OBŸªy'¦„§¨ž§ €ÐÈ#*>¿à¶Ú¿þæ&?¨mk›[˜×\—ííµ; 2„Ãç¶Õ× ‘!#ÁYˆ³ @òB( î?òýz$Ö¢Hýn§õÊNöa+—¹ºœJ™x‘\繪I£yw…Óš3?¾t>Cÿa)ôˆµù¡ 8I `î’Aáá‘—¼Ï á.¬ð|pøÍ¥V®ñ‡*à‰·¬bq1TA37n÷ŒW¾Zá'ã¾¾£yG#.D"‘…C©jÒµZ*Ú1µmª@nª@ªHªÁ@y&d#*¼ @U²¡[#*a÷®›kËjÚV´·tj�bVÛ_‚ÖÕj™�B$‰c3L@LˆhÆm2¢$¦¤KJQ¥ÛIPŠ™$±@°š6¦¢©(0ˆ”&h›([)Œ•™AF’XКaJ#.�$RlE¢”Ú"’”´¦E¨€@K-$$Á0e$RØ¢Ú-&¨ƒ)eE,MJ2PRJ)¥0³5�EiVÒ«R’mDÉ™2hتµ+XÍ0Í™¦mIc4Û`–›b$jZšdÔÂȦI5@ÈÔ�+I¬„TšM™%#.$´�Z)Mc$3dÑ0BÁFfšc4ØÄÁ*i`�‚1fb“"QPÙ6¤�"– !“C$Fd!# ,Í,Rdƒi0ÆJi-¤¨´LjTІ,“#,i¤ØQ$¢M‘J&1bb Ù2›E$ËHe$M,�)’¥S2,m�¨dQ,(‹$„‘#.lE¤°6j2AQ#.D”Tj"#.‰)#.fÄI©,Rb� )É2fŒÂ2[2¦A°•!BT›!$šJÁ‰),Yf`Ù´FšF�„”BÊHIš#,"S5K6YJ(1–a“K$ÔÓ(ÐK–dlhÊÈLÄ’(´-,�*$°†ÊƒM™A�FÍ#c¦–$¦¶š#,Bf‘E˜ˆÔ™)4�¦’–Z4YR¢¢‰…LI‘%()ŒhFHi˜ DC*f[HŠÂ•HC)R6L…)#.m%¤¢Ù#XÒL’J‹%5‘l&�™™¢##,’M•&™MDb1–T33Jb¡S&ˆ©¢1f¦Å&QddÄ”ŠT’BÊ*dX”Ó#h1I“e$Ì6M“FL…CHÀ„j(I–R²“#, ²l”�&B&K&Q�Šfƒ$e2‘–&a-%*›4Tm„Ê ‘)"#,¨Å±¤™¬ŠLla$0Œ¨Ò(TJ(Ö*Y0£XË52DÍL3,ˆ”!ŠY#*j4””e¤6kjm¶ÐQl`’¦�i(1”‘¢Å2S$Æ“FÙ-)f�1I˜Êf–T›)bÔÈÆÂÙ%6Q”ŒÐ!¦Ë_Ãmv4…•¤¤%J2SX«EbÑQ²IšTDÓ%KAQ°Š’V¦"†Æ–!™e) RF³*Ô&Ú,Šk&Cc)–•E¡bd¦5-*c$�&,32•Y£e”#k*ER©X¦Ê$²£)µdÔˆÖɦVD©5 [%YYJSL+f(i‘5£KMD–’�%ƱXÕ3h¶ÛH3`±ªÂF¤Ñ¶ÆÑ±²Qª3LÄ5E!¨4jÅQ°ÍHmbY0¢5³Rhe1%‚h±„5(”Ú–Äm$šÆ5!b´’šµ³VÓA,#ei6F&³l‰3)©¥#.I–Õ6¢–’”Ô²¤¶š¦ÒZ¦˜“²¦Rɶ–m¦ÌZ4f¶k32I¬±¡›¤ÛKYRSJ(ˆC5J4‰ŒQ°�b„- 3–ѵ$JME2š£iI¥�FLš#,%0ŠE,¨�ŠAieH€i¢˜)’�e6hbÄ„¤TZ,Éb•š’ÀclË3K1š`©¨™Ñ2FLlBÌK!I´lI¤£&h4‹2‹S2TÅ4Rma3`Ñ#.TXÌ1S6 RÉBlE†54Ú33h¨±±±F„hÆÉ©¡"“aK-�“$¤¦L¦Á’Ø…3R‰2I²ÒˆJ¨²Ô™¢6”ÒlÆÒei+Ä#”dfM”“BTš“)FÌÓj[,Ø´”³I²lbTQfŠJfdÑ©–´Œ”¥¢ÁH‘›$FY‘1¢Òš#@ÖY6Jhbb&“I F¢5BTm�mˆ1¤ÃI2ÄÊ&‘h¦•É K#.¥e$š� *5“0²ie24´›mIkhЙfÚ‚H´–ÅA£,#,›R”J�QliIš¨Ù&k2*H’£I"Ë*ÔÆ†MEc&&VJˆ¦”¡Q¥%4ET±*Je)FÛ`µ$Qd£dª0Ê6Kd¤Ô›j”ÑIEJj�µ&ÅCI3d†RTXiH‹- ””ÆhÁ´˜#.‰3BÁª”FÈÊV&#JKEhƲEd„6%`Š1”¶#h¬¤”T€h1E&“V”ZST¦Òj-±¬VÍ1Y-f�¢©š’‹Å(#(1³B$¡4l”Á£VÄm�‹hØÒšÖHe¢#.Æ&¢Ñ�6Ë6£h´TZÆI5©fÍ�ÒÊĪ1h³,UMIHÛ(Ë)DÒFÊÅ`’Æ’Ù-�d¢Ô–±I´¦eM¢Â‘QIF‹kT´ŒeCI¢$©”Z66† ÒZ[$ÛIŒÉl‚›%Eµ$¶ŠÑ‹FÛhÚ¡K&ÖÄZ¦¥e´J2ŠbFÒL`©lMšlT‘²È¨ ™�‰1$™I2$¡jM±fV¦?¥óþšþ’ÿI¯ä7ÏÎÞûÅíͦD˜º›a?îØÀ¥þL¶‹l‚››+»Ieî÷Ëúkø½zþ�ôzú´/¨ÝNDÿíNƒTlÿsäAQ‡œ 3·I¼‡H¼«M.Y#,É`¥q#LèÄW\ª’�ô;=q‡¼³üwhÁæY“þ×øyòÇú7V2ñÆ]QTÈ¥�ÕÜ…£á; 'tݹÃéÁ¾,>?—KßV£#.g…ÔÂ~ò‹o-5ƒ±Z8bå¥åâð£L|HÞâ#�Õ´t„º¢°YWVÚ¶…ˆ°yÔ)ÁQÅTUva¥¥di2Ó†®Y×[#¿+Êní·eâøW…òë…_%|=?Ÿ×²½Uð.nZ65³A5_e×’yʉ-wË«¼»�Ö‰ü�S/†æ’Å‚(,jìµc–£[ܰðÑþK�„L!ÆÂ¤#,j½©6eŒU=Ôe±‚ȱ~?é¹aßÝZ3#*©Ñ#.7ªAOS(C(`)<s¡Xÿ;’˜ÒµT’Ø–QGåœgþ‘ɨðM,"60I§´ÓÕ©–:–ùCP›#,�]{A‹ÿL>L>X�nëv#.D`Äcy¹j(0ª) »�ÍÌšB“VH5)ð��¶#*°Ÿ* é^WIæ�¢3v’™IöÔ –%(16ãd‡ÎÈ—:tò$À"¶RÇ5$¡ès(´„:†%Š¿ÁU|§ªù6ÝJ¯†á v(Ã"ƒáôÞÞ–FDR�OH«G,ŠiR°›�€ÜFF1ºë±:ë¦*#,õ-o/;ý»ì»È�¢Vhh”#v‰[)[ˆ‘A_®ª#=tV¿ž´ÇZì½0L°¶ŠM’Š'}Li6ÂJ°¹@`@hQÆ?ÊW1�ïåÉ#,.¢0í¥ýf°Àª´�ÆN9ªù#,tüâçïò陸ŠÕgxVzêæ$Ï5u¨âyÌïÿ\‹ØÎÔah�^Ðy*ZíŒ9ÐÙ¡:.Z¡ÝÜûRÒ;Éê¹Úî—´0÷°9!àášjУij?+9j&gJå4“ÑÂÑ�íJ[›¥ó¸IàÌ$[IàXRÁ`—§[ÇÜü±FÈÛZ,Ù*±)AKh[òeÔ˜ø›·õkX&ÃRÒ7hïú$KÙ!¦ÚÆM÷]¦É(È߃®×Þ»£f|†q²‰—[+›‘/W(Eÿ‰¥ð*‘æ×H¯LŽVÚiþ]!F1d"}äom’êmcF¼s2ɼk—-�Wî<¦£O¼àѷ߃«õ3ýu}ßäö¾—ÅÚ1ËsF«º¸±¢ÈIˆÃ-'½×+Ï;jJèÐÈ«:r£ „‹Å#.ÈK…¼UÓV7«Éù}è¥/›•#.g)q‘T´)c>Ñ…ÑK³E%²a|»WF÷¾¯<‡š,kM_IþÃx¾Jäm~7P�yÝ£ˆz^#,C@ÿÒ8¬D`Æ—ø�:£ù¨œòT0ˆÄWJÚÍ�ò@00b"m}]ûO+›u7Î]HÑ\âXÓ�P¤ÝÜd-7ª¸,´jÔ’Ö,p•Œ¦B„º‰4֔ݟ$×R…E`xÕÒ¢&½÷|Ä#.ÇÏnx2Oë“Nþë´ˆ,“%R0žVQɆ¨ZdiG•R[´NŽ •w<@Ñ-#,2ÒUX¢ŒÔ¥TîhÊï‚ØŠœ+ÒèVsî¨z3#*£É{à–xÕ6�®¸4P쎘=¶RþhËUc=®³äEZžºcL°x‚?±Ï„ôPƒÊ¹>¨hs1óÅV|êXš¡/'.H°#Åé#~DòÚ˜†‘�¦ÃˆEaå/Âiÿ��X¤Ç×/ä™» À§oÙ4 ÿWÍøMtèN˜H5§‹Ó¤xWí8Line truncated
|
||||
#<==
|
||||
@@ -1,19 +0,0 @@
|
||||
import re
|
||||
|
||||
def options(opt):
|
||||
opt.load("compiler_cxx")
|
||||
|
||||
def configure(conf):
|
||||
conf.load("compiler_cxx")
|
||||
conf.define("SHARE_DIR", re.sub(r'/$', "", conf.options.prefix) + "/share/svi")
|
||||
conf.check_cfg(package = "ruby", args = "--cflags --libs", uselib_store = "ruby")
|
||||
|
||||
def build(bld):
|
||||
bld(features = "cxx cxxprogram",
|
||||
target = "svi",
|
||||
source = bld.path.ant_glob("src/**/*.cc"),
|
||||
cxxflags = ["-Wall", "-std=gnu++14"],
|
||||
uselib = ["ruby"])
|
||||
share_dir = bld.path.find_dir("share/svi")
|
||||
bld.install_files("${PREFIX}/share/svi", share_dir.ant_glob("**/*"),
|
||||
cwd = share_dir, relative_trick = True)
|
||||
Reference in new issue
Block a user