Skip to content

Commit

Permalink
version 0.1-11
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Schwendinger authored and cran-robot committed Mar 19, 2020
1 parent d787c9b commit 3a2f12d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 15 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: PythonInR
Title: Use 'Python' from Within 'R'
Version: 0.1-9
Version: 0.1-11
Authors@R: c( person("Florian", "Schwendinger", role = c("aut", "cre"),
email = "FlorianSchwendinger@gmx.at"),
person("Kimyen", "Truong", role = "ctb") )
Expand All @@ -16,9 +16,9 @@ BugReports: https://bitbucket.org/Floooo/pythoninr/issues
License: GPL-3
NeedsCompilation: yes
RoxygenNote: 6.1.1
Packaged: 2020-03-09 18:53:39 UTC; florian
Packaged: 2020-03-15 09:44:29 UTC; florian
Author: Florian Schwendinger [aut, cre],
Kimyen Truong [ctb]
Maintainer: Florian Schwendinger <FlorianSchwendinger@gmx.at>
Repository: CRAN
Date/Publication: 2020-03-10 06:50:21 UTC
Date/Publication: 2020-03-19 05:20:08 UTC
10 changes: 5 additions & 5 deletions MD5
@@ -1,5 +1,5 @@
0c9df7953c463761b277567bb139853f *ChangeLog
f120060a5c39e26e24969f5b8393f847 *DESCRIPTION
643a3fd502ef937c41ff659626c3eb1c *DESCRIPTION
fdf8803f84f1d032720c76c1dabdba0e *NAMESPACE
8f23ca90a540abd478e8eae1d9f7ca1a *R/AutodetectPython.R
37aab45a28757b4fd42d86ca69f2a817 *R/Basics.R
Expand All @@ -22,7 +22,7 @@ e9b54a51e96a787b28ad51f94e03c898 *R/Utility.R
b8313baf3d27ccdb477556c07b37f2b1 *R/zzz.R
873763a1e1dc563e392f21866860a148 *README.md
75a78cb0c1fa53ba6696b487f37ef4c2 *cleanup
2279dda51f0fa53ccd2b57dc0370100e *configure
95bd57b671bbe3e74567afcceaef2f29 *configure
70031f25497e1421e156bd2d5316fc9e *inst/testing/Basics.R
aa867dd99ecb0cddd42f1af8d31e592c *inst/testing/NA_NaN_Inf.R
a4f40b6366bc25896b02d8c2a13fff19 *inst/testing/PyAttach.R
Expand Down Expand Up @@ -71,14 +71,14 @@ db5c84655c1e971494d99587c9e14820 *man/pyTuple.Rd
1f5354226008b9de135e496d48884822 *src/CastRObjects.h
91471cf85c09b13d3ab936fba7e0e542 *src/GetPyObjects.c
12fa0d8d4591328ddb4c1a680bad13d5 *src/GetPyObjects.h
049dc07c7696793feecf168f968da0b1 *src/Makevars.in
2e6af85958f48ca88917aef498146742 *src/Makevars.in
67e8d5b072c91b99b6ec67f5fa0f80d8 *src/PyCall.c
254e9df8b96b33f9d891f1fcadd81768 *src/PyCall.h
a4ecd1bb63a3a910f88ef47d06b15cef *src/PyRunString.c
11c1b74ede8a0f64f160b697d5b76d10 *src/PyRunString.h
e45ce46c647d1c984bbd37a7c5702981 *src/PythonInR.c
3f7064d24f938c45852c5c5a0acae69f *src/PythonInR.c
d1f439812dbdd40ca37056a9d05924e5 *src/PythonInR.h
ba8f53303ece4d0b8b2d80db7c74fe8e *src/PythonInRMacros.h
941d826d094c3f8946564da5e6f9894a *src/PythonInRMacros.h
d829082338e1eeca516b55ac4ca404f9 *src/Python_Explicit_Linking.c
14c8f81104bf84dcbf2e4ce40d858df7 *src/Python_Explicit_Linking.h
0eeac7180090051d5e018f5951e35054 *src/SetPyObjects.c
Expand Down
9 changes: 9 additions & 0 deletions configure
Expand Up @@ -23,6 +23,15 @@ if ! [ -z "$USESPECIALPYTHONVERSION" ]; then
alias python3="$USESPECIALPYTHONVERSION"
fi

if ! [ -z "$(python3 -V 2>&1 | grep 'python')" ]; then
if ! [ -z "$(python -V 2>&1 | grep 'python')" ]; then
echo "Could not find python!"
exit 1
else
alias python3=python
fi
fi

PYVERSION=`python3 -c "import sys;import distutils.sysconfig as sc;sys.stdout.write(sc.get_config_var('VERSION'))"`
PYINCLUDE=`python3 -c "import sys;import distutils.sysconfig as sc;sys.stdout.write(sc.get_config_var('INCLUDEPY'))"`
PYBINPATH=`python3 -c "import sys;import os;sys.stdout.write(os.path.dirname(sys.executable))"`
Expand Down
2 changes: 1 addition & 1 deletion src/Makevars.in
Expand Up @@ -2,7 +2,7 @@
# ‘-Wdate-time’ ‘-Werror=format-security’ ‘-Wformat’

PKG_LIBS=@PKG_LIBS@
PKG_CFLAGS=@PKG_CFLAGS@ -D @PYXY@ -D PYTHON_IN_R_NO_EXPLICIT_LINKING
PKG_CFLAGS=@PKG_CFLAGS@ -D@PYXY@ -DPYTHON_IN_R_NO_EXPLICIT_LINKING

OBJECTS = CToR.o PythonInR.o CastPyObjects.o CastRObjects.o GetPyObjects.o init.o PyCall.o PyRunString.o Python_Explicit_Linking.o SetPyObjects.o

Expand Down
6 changes: 5 additions & 1 deletion src/PythonInR.c
Expand Up @@ -85,7 +85,11 @@ SEXP py_connect(SEXP initvars){

Py_InitializeEx(asInteger(initvars));
PySys_SetArgv(1, argv);
Py_SetProgramName(PY_V_CHAR("PythonInR"));
#if PY_MAJOR_VERSION >= 3
Py_SetProgramName(L"PythonInR");
#else
Py_SetProgramName("PythonInR");
#endif

PyRun_SimpleString("import sys; sys.path.append('.')");

Expand Down
6 changes: 1 addition & 5 deletions src/PythonInRMacros.h
Expand Up @@ -96,8 +96,6 @@
// ---------------------------------------------------------------------
// Python 3
// ---------------------------------------------------------------------
#define PY_V_CHAR(s) (wchar_t *)s
#define PY_V_CHAR2(s) PyUnicode_FromString(s)
#define PY_TO_C_OBJECT_STRING PY_TO_C_UNICODE
//#define PyString_FromString(s) PyUnicode_FromFormat("%s", s)
#define PyString_AsString PyBytes_AsString
Expand All @@ -113,12 +111,10 @@
// ---------------------------------------------------------------------
// Python tested with 2.7 but should work also with earlier versions
// ---------------------------------------------------------------------
#define PY_V_CHAR(s) s
#define PY_V_CHAR2(s) s
#define PY_TO_C_OBJECT_STRING PY_TO_C_STRING
#define PyUnicode_FromConstChar(s) PyUnicode_FromString(s)
#define PyInternalString_FromString(s) PyString_FromString(s)
#endif
#endif
#endif

#endif

0 comments on commit 3a2f12d

Please sign in to comment.