pycall 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/.travis.yml +45 -29
- data/CHANGES.md +5 -0
- data/ci/travis_before_script.sh +21 -0
- data/ci/travis_install.sh +48 -0
- data/ci/travis_retry.sh +19 -0
- data/lib/pycall/libpython/finder.rb +16 -0
- data/lib/pycall/python/investigator.py +5 -0
- data/lib/pycall/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 254de6af22a7da5928ad1f5233727a7ac378c84c
|
4
|
+
data.tar.gz: fc897d3873076f610b527fb23841c4044793e317
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32b60a4408b80fd5df671b8c1c9177d5973ff9fff11603ea0f4dd9407dbb27e39532f7d269cd7d5805e0e275ab2e5e9e956a247100160ecc091028b9757828df
|
7
|
+
data.tar.gz: 79d9c857888a3577f76428247bc73e999df73cbbac3269d39c86765d2b6656f32ca916caf54fe955921842a9119141e60b53d1a16973de63cf1a154b08715f27
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,41 +1,57 @@
|
|
1
|
-
sudo: false
|
2
1
|
language: ruby
|
3
2
|
|
3
|
+
os: linux
|
4
|
+
|
5
|
+
dist: trusty
|
6
|
+
sudo: required
|
7
|
+
|
4
8
|
rvm:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
9
|
+
- ruby-head
|
10
|
+
- 2.4.2
|
11
|
+
- 2.3.5
|
12
|
+
- 2.2.8
|
13
|
+
- 2.1.10
|
10
14
|
|
11
15
|
env:
|
12
16
|
global:
|
13
17
|
- PYCALL_DEBUG_FIND_LIBPYTHON=1
|
14
18
|
matrix:
|
15
|
-
-
|
16
|
-
-
|
17
|
-
- PYENV_VERSION=
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
- PYENV_VERSION=2.7.13
|
20
|
+
- PYENV_VERSION=3.6.2
|
21
|
+
- PYENV_VERSION=system LIBPYTHON=versions/3.6.2/lib/libpython3.6m.so
|
22
|
+
- PYENV_VERSION=miniconda2-4.1.11
|
23
|
+
- PYENV_VERSION=miniconda3-4.3.11
|
24
|
+
|
25
|
+
matrix:
|
26
|
+
include:
|
27
|
+
- os: osx
|
28
|
+
osx_image: xcode9
|
29
|
+
compiler: clang
|
30
|
+
rvm: 2.4.1
|
31
|
+
env: PYENV_VERSION=3.6.2
|
32
|
+
- os: osx
|
33
|
+
osx_image: xcode9
|
34
|
+
compiler: clang
|
35
|
+
rvm: 2.4.1
|
36
|
+
env: PYENV_VERSION=system LIBPYTHON=versions/3.6.2/lib/libpython3.6m.so
|
37
|
+
- os: osx
|
38
|
+
osx_image: xcode9
|
39
|
+
compiler: clang
|
40
|
+
rvm: 2.4.1
|
41
|
+
env: PYENV_VERSION=miniconda3-4.3.11
|
42
|
+
allow_failure:
|
43
|
+
- os: osx
|
26
44
|
|
27
45
|
before_install:
|
28
|
-
|
29
|
-
|
46
|
+
- gem update --system
|
47
|
+
- gem update bundler
|
48
|
+
- export PATH="$(pyenv root)/bin:$PATH"
|
49
|
+
- eval "$(pyenv init -)"
|
30
50
|
|
31
|
-
|
32
|
-
|
33
|
-
- echo === python investigator.py ===
|
34
|
-
- python lib/pycall/python/investigator.py
|
35
|
-
- python3 lib/pycall/python/investigator.py
|
36
|
-
- travis_retry pip install --user numpy
|
37
|
-
- PYENV_VERSION=3.5.3 travis_retry pip3 install --user numpy
|
51
|
+
install:
|
52
|
+
- ci/travis_install.sh
|
38
53
|
|
39
|
-
|
40
|
-
|
41
|
-
|
54
|
+
before_script:
|
55
|
+
- . ci/travis_before_script.sh
|
56
|
+
- bundle exec rake clobber compile
|
57
|
+
- python lib/pycall/python/investigator.py
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# The change history of PyCall
|
2
2
|
|
3
|
+
## 1.0.3
|
4
|
+
|
5
|
+
* Fix anaconda support to define the environment variable `PYTHONHOME`.
|
6
|
+
https://github.com/mrkn/pycall.rb/issues/37
|
7
|
+
|
3
8
|
## 1.0.2
|
4
9
|
|
5
10
|
* Fix the bug that a large Python string is broken when it converted to Ruby string
|
@@ -0,0 +1,21 @@
|
|
1
|
+
__DIR__=$(cd $(dirname $BASH_SOURCE); pwd)
|
2
|
+
. $__DIR__/travis_retry.sh
|
3
|
+
|
4
|
+
set -ex
|
5
|
+
|
6
|
+
if test -z "$PYENV_VERSION"; then
|
7
|
+
echo "ERROR: PYENV_VERSION is not provided" >2
|
8
|
+
exit 1
|
9
|
+
fi
|
10
|
+
|
11
|
+
if test -n "$LIBPYTHON"; then
|
12
|
+
export LIBPYTHON=$(pyenv root)/$LIBPYTHON
|
13
|
+
fi
|
14
|
+
|
15
|
+
case "$PYENV_VERSION" in
|
16
|
+
*conda*)
|
17
|
+
source $(pyenv prefix)/bin/activate test-environment
|
18
|
+
;;
|
19
|
+
esac
|
20
|
+
|
21
|
+
set +ex
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#! /bin/bash
|
2
|
+
|
3
|
+
__DIR__=$(cd $(dirname $BASH_SOURCE); pwd)
|
4
|
+
. $__DIR__/travis_retry.sh
|
5
|
+
|
6
|
+
set -ex
|
7
|
+
|
8
|
+
if test -z "$PYENV_VERSION"; then
|
9
|
+
echo "ERROR: PYENV_VERSION is not provided" >2
|
10
|
+
exit 1
|
11
|
+
fi
|
12
|
+
|
13
|
+
if test -n "$LIBPYTHON"; then
|
14
|
+
export LIBPYTHON=$(pyenv root)/$LIBPYTHON
|
15
|
+
fi
|
16
|
+
|
17
|
+
if test "$PYENV_VERSION" = "system"; then
|
18
|
+
if test -z "$LIBPYTHON"; then
|
19
|
+
echo "ERROR: LIBPYTHON is not provided for PYENV_VERSION=system" >2
|
20
|
+
exit 1
|
21
|
+
fi
|
22
|
+
# NOTE: PYENV_VERSION should be the version of LIBPYTHON during install script
|
23
|
+
PYENV_VERSION=$(basename $(dirname $(dirname $LIBPYTHON)))
|
24
|
+
fi
|
25
|
+
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -f $PYENV_VERSION
|
26
|
+
|
27
|
+
case "$PYENV_VERSION" in
|
28
|
+
*conda*)
|
29
|
+
case "$PYENV_VERSION" in
|
30
|
+
*conda2*)
|
31
|
+
python_version=2.7
|
32
|
+
;;
|
33
|
+
*)
|
34
|
+
python_version=3.6
|
35
|
+
;;
|
36
|
+
esac
|
37
|
+
conda config --set always_yes yes --set changeps1 no
|
38
|
+
travis_retry conda update -q conda
|
39
|
+
conda info -a
|
40
|
+
travis_retry conda create -q -n test-environment python=$python_version numpy
|
41
|
+
source $(pyenv prefix)/bin/activate test-environment
|
42
|
+
;;
|
43
|
+
*)
|
44
|
+
travis_retry pip install --user numpy
|
45
|
+
;;
|
46
|
+
esac
|
47
|
+
|
48
|
+
bundle install
|
data/ci/travis_retry.sh
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
travis_retry ()
|
2
|
+
{
|
3
|
+
local result=0
|
4
|
+
local count=1
|
5
|
+
while [ $count -le 3 ]; do
|
6
|
+
[ $result -ne 0 ] && {
|
7
|
+
echo -e "\n${ANSI_RED}The command \"$@\" failed. Retrying, $count of 3.${ANSI_RESET}\n" 1>&2
|
8
|
+
}
|
9
|
+
"$@"
|
10
|
+
result=$?
|
11
|
+
[ $result -eq 0 ] && break
|
12
|
+
count=$(($count + 1))
|
13
|
+
sleep 1
|
14
|
+
done
|
15
|
+
[ $count -gt 3 ] && {
|
16
|
+
echo -e "\n${ANSI_RED}The command \"$@\" failed 3 times.${ANSI_RESET}\n" 1>&2
|
17
|
+
}
|
18
|
+
return $result
|
19
|
+
}
|
@@ -39,6 +39,7 @@ module PyCall
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
set_PYTHONHOME(python_config)
|
42
43
|
libs = make_libs(python_config)
|
43
44
|
libpaths = make_libpaths(python_config)
|
44
45
|
|
@@ -101,6 +102,10 @@ module PyCall
|
|
101
102
|
{}.tap do |config|
|
102
103
|
io.each_line do |line|
|
103
104
|
key, value = line.chomp.split(': ', 2)
|
105
|
+
case value
|
106
|
+
when 'True', 'true', 'False', 'false'
|
107
|
+
value = (value == 'True' || value == 'true')
|
108
|
+
end
|
104
109
|
config[key.to_sym] = value if value != 'None'
|
105
110
|
end
|
106
111
|
end
|
@@ -113,6 +118,17 @@ module PyCall
|
|
113
118
|
File.expand_path('../../python/investigator.py', __FILE__)
|
114
119
|
end
|
115
120
|
|
121
|
+
def set_PYTHONHOME(python_config)
|
122
|
+
if !ENV.has_key?('PYTHONHOME') && python_config[:conda]
|
123
|
+
case RUBY_PLATFORM
|
124
|
+
when /mingw32/, /cygwin/, /mswin/
|
125
|
+
ENV['PYTHONHOME'] = python_config[:exec_prefix]
|
126
|
+
else
|
127
|
+
ENV['PYTHONHOME'] = python_config.values_at(:prefix, :exec_prefix).join(':')
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
116
132
|
def make_libs(python_config)
|
117
133
|
libs = []
|
118
134
|
%i(INSTSONAME LDLIBRARY).each do |key|
|
@@ -1,7 +1,12 @@
|
|
1
1
|
from distutils.sysconfig import get_config_var
|
2
2
|
import sys
|
3
|
+
|
4
|
+
def conda():
|
5
|
+
return 'conda' in sys.version or 'Continuum' in sys.version
|
6
|
+
|
3
7
|
for var in ('executable', 'exec_prefix', 'prefix'):
|
4
8
|
print(var + ': ' + str(getattr(sys, var)))
|
9
|
+
print('conda: ' + ('true' if conda() else 'false'))
|
5
10
|
print('multiarch: ' + str(getattr(getattr(sys, 'implementation', sys), '_multiarch', None)))
|
6
11
|
for var in ('VERSION', 'INSTSONAME', 'LIBRARY', 'LDLIBRARY', 'LIBDIR', 'PYTHONFRAMEWORKPREFIX', 'MULTIARCH'):
|
7
12
|
print(var + ': ' + str(get_config_var(var)))
|
data/lib/pycall/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pycall
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenta Murata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -144,6 +144,9 @@ files:
|
|
144
144
|
- bin/rspec
|
145
145
|
- bin/runner
|
146
146
|
- bin/setup
|
147
|
+
- ci/travis_before_script.sh
|
148
|
+
- ci/travis_install.sh
|
149
|
+
- ci/travis_retry.sh
|
147
150
|
- config/Guardfile
|
148
151
|
- docker/Dockerfile
|
149
152
|
- docker/Gemfile
|