You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2016/08/26 17:30:29 UTC

[1/6] lucy-clownfish git commit: Fix nullary function declarations

Repository: lucy-clownfish
Updated Branches:
  refs/heads/master a47be68a0 -> 8c6d95a34


Fix nullary function declarations


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/ace28017
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/ace28017
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/ace28017

Branch: refs/heads/master
Commit: ace28017f14061bcf85cd610056862bd59b0ec11
Parents: a47be68
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri Aug 26 13:55:24 2016 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Aug 26 13:55:24 2016 +0200

----------------------------------------------------------------------
 compiler/modules/CommonMark/src/cmark.h        | 4 ++--
 compiler/src/CFCGoClass.h                      | 2 +-
 compiler/src/CFCPerlClass.h                    | 2 +-
 compiler/src/CFCPyClass.h                      | 2 +-
 runtime/core/Clownfish/ByteBuf.c               | 2 +-
 runtime/core/Clownfish/CharBuf.c               | 2 +-
 runtime/core/Clownfish/TestHarness/TestSuite.c | 2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ace28017/compiler/modules/CommonMark/src/cmark.h
----------------------------------------------------------------------
diff --git a/compiler/modules/CommonMark/src/cmark.h b/compiler/modules/CommonMark/src/cmark.h
index 4a85f26..a4847ed 100644
--- a/compiler/modules/CommonMark/src/cmark.h
+++ b/compiler/modules/CommonMark/src/cmark.h
@@ -538,13 +538,13 @@ char *cmark_render_latex(cmark_node *root, int options, int width);
  * In hexadecimal format, the number 0x010203 represents version 1.2.3.
  */
 CMARK_EXPORT
-int cmark_version();
+int cmark_version(void);
 
 /** The library version string for runtime checks. Also available as
  * macro CMARK_VERSION_STRING for compile time checks.
  */
 CMARK_EXPORT
-const char *cmark_version_string();
+const char *cmark_version_string(void);
 
 /** # AUTHORS
  *

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ace28017/compiler/src/CFCGoClass.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGoClass.h b/compiler/src/CFCGoClass.h
index 4e2cacf..2c3e332 100644
--- a/compiler/src/CFCGoClass.h
+++ b/compiler/src/CFCGoClass.h
@@ -50,7 +50,7 @@ CFCGoClass_singleton(const char *class_name);
 /** All registered class bindings.
  */
 CFCGoClass**
-CFCGoClass_registry();
+CFCGoClass_registry(void);
 
 /** Release all memory and references held by the registry.
  */

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ace28017/compiler/src/CFCPerlClass.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlClass.h b/compiler/src/CFCPerlClass.h
index 60bd08a..9713379 100644
--- a/compiler/src/CFCPerlClass.h
+++ b/compiler/src/CFCPerlClass.h
@@ -61,7 +61,7 @@ CFCPerlClass_singleton(const char *class_name);
 /** All registered class bindings.
  */
 CFCPerlClass**
-CFCPerlClass_registry();
+CFCPerlClass_registry(void);
 
 /** Release all memory and references held by the registry.
  */

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ace28017/compiler/src/CFCPyClass.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPyClass.h b/compiler/src/CFCPyClass.h
index b905502..8ec5d54 100644
--- a/compiler/src/CFCPyClass.h
+++ b/compiler/src/CFCPyClass.h
@@ -46,7 +46,7 @@ CFCPyClass_singleton(const char *class_name);
 /** All registered class bindings.
   */
 CFCPyClass**
-CFCPyClass_registry();
+CFCPyClass_registry(void);
 
 /** Release all memory and references held by the registry.
   */

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ace28017/runtime/core/Clownfish/ByteBuf.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/ByteBuf.c b/runtime/core/Clownfish/ByteBuf.c
index dc03cf5..6bb0072 100644
--- a/runtime/core/Clownfish/ByteBuf.c
+++ b/runtime/core/Clownfish/ByteBuf.c
@@ -42,7 +42,7 @@ S_grow_and_oversize(ByteBuf *self, size_t min_size);
 // Not inlining the THROW macro reduces code size and complexity of
 // SI_add_grow_and_oversize.
 static void
-S_overflow_error();
+S_overflow_error(void);
 
 ByteBuf*
 BB_new(size_t capacity) {

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ace28017/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/CharBuf.c b/runtime/core/Clownfish/CharBuf.c
index 30f54dd..313083a 100644
--- a/runtime/core/Clownfish/CharBuf.c
+++ b/runtime/core/Clownfish/CharBuf.c
@@ -54,7 +54,7 @@ S_grow_and_oversize(CharBuf *self, size_t min_size);
 // Not inlining the THROW macro reduces code size and complexity of
 // SI_add_grow_and_oversize.
 static void
-S_overflow_error();
+S_overflow_error(void);
 
 // Helper function for throwing invalid format specifier error.
 static void

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ace28017/runtime/core/Clownfish/TestHarness/TestSuite.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/TestHarness/TestSuite.c b/runtime/core/Clownfish/TestHarness/TestSuite.c
index c382a9b..4293640 100644
--- a/runtime/core/Clownfish/TestHarness/TestSuite.c
+++ b/runtime/core/Clownfish/TestHarness/TestSuite.c
@@ -32,7 +32,7 @@
 #include "Clownfish/Class.h"
 
 static void
-S_unbuffer_stdout();
+S_unbuffer_stdout(void);
 
 TestSuite*
 TestSuite_new() {


[6/6] lucy-clownfish git commit: Add Python bindings to CI tests

Posted by nw...@apache.org.
Add Python bindings to CI tests

The Travis tests are still disabled. Compiling _clownfish.c fails
because the GCC version doesn't default to C99.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/8c6d95a3
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/8c6d95a3
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/8c6d95a3

Branch: refs/heads/master
Commit: 8c6d95a34e956e034fa86b1163218bc7ce723ea1
Parents: 6a5fed4
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri Aug 26 19:03:40 2016 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Aug 26 19:23:22 2016 +0200

----------------------------------------------------------------------
 .travis.yml                  | 27 +++++++++++++++++----------
 appveyor.yml                 |  3 ++-
 devel/bin/appveyor-build.bat | 17 +++++++++++++++++
 devel/bin/travis-test.sh     | 10 ++++++++++
 4 files changed, 46 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8c6d95a3/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 88aafc4..7bd87b7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,16 +18,23 @@ sudo: false
 # Override Travis' default Perl installation script.
 install: 'true'
 script: devel/bin/travis-test.sh
-env:
-  - CLOWNFISH_HOST=c
-  - CLOWNFISH_HOST=go
-  - CLOWNFISH_HOST=perl PERL_VERSION=5.20-extras
-  - CLOWNFISH_HOST=perl PERL_VERSION=5.18-extras
-  - CLOWNFISH_HOST=perl PERL_VERSION=5.16
-  - CLOWNFISH_HOST=perl PERL_VERSION=5.14
-  - CLOWNFISH_HOST=perl PERL_VERSION=5.12
-  - CLOWNFISH_HOST=perl PERL_VERSION=5.10
-  - CLOWNFISH_HOST=perl PERL_VERSION=5.8
+matrix:
+  include:
+    - env: CLOWNFISH_HOST=c
+    - env: CLOWNFISH_HOST=go
+    - env: CLOWNFISH_HOST=perl PERL_VERSION=5.20-extras
+    - env: CLOWNFISH_HOST=perl PERL_VERSION=5.18-extras
+    - env: CLOWNFISH_HOST=perl PERL_VERSION=5.16
+    - env: CLOWNFISH_HOST=perl PERL_VERSION=5.14
+    - env: CLOWNFISH_HOST=perl PERL_VERSION=5.12
+    - env: CLOWNFISH_HOST=perl PERL_VERSION=5.10
+    - env: CLOWNFISH_HOST=perl PERL_VERSION=5.8
+#    - env: CLOWNFISH_HOST=python
+#      addons:
+#        apt:
+#          packages:
+#           - python3
+#           - python3-dev
 git:
   depth: 10
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8c6d95a3/appveyor.yml
----------------------------------------------------------------------
diff --git a/appveyor.yml b/appveyor.yml
index 277e2af..5a53d05 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -15,6 +15,8 @@
 
 environment:
   matrix:
+    - CLOWNFISH_HOST: python
+    - CLOWNFISH_HOST: perl
     - CLOWNFISH_HOST: c
       BUILD_ENV: msys2
       MSYSTEM: MINGW64
@@ -26,7 +28,6 @@ environment:
     - CLOWNFISH_HOST: c
       BUILD_ENV: msvc
       MSVC_VERSION: 12
-    - CLOWNFISH_HOST: perl
 
 build: off
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8c6d95a3/devel/bin/appveyor-build.bat
----------------------------------------------------------------------
diff --git a/devel/bin/appveyor-build.bat b/devel/bin/appveyor-build.bat
index 46e2bf7..4300418 100644
--- a/devel/bin/appveyor-build.bat
+++ b/devel/bin/appveyor-build.bat
@@ -17,6 +17,7 @@ rem limitations under the License.
 
 if "%CLOWNFISH_HOST%" == "c" goto test_c
 if "%CLOWNFISH_HOST%" == "perl" goto test_perl
+if "%CLOWNFISH_HOST%" == "python" goto test_python
 
 echo unknown CLOWNFISH_HOST: %CLOWNFISH_HOST%
 exit /b 1
@@ -83,3 +84,19 @@ perl Build.PL && call Build && call Build test
 
 exit /b
 
+:test_python
+
+path C:\Python35-x64;%path%
+python -V
+
+set DISTUTILS_USE_SDK=1
+call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
+
+cd compiler\python
+python setup.py test || exit /b
+
+cd ..\..\runtime\python
+python setup.py test
+
+exit /b
+

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8c6d95a3/devel/bin/travis-test.sh
----------------------------------------------------------------------
diff --git a/devel/bin/travis-test.sh b/devel/bin/travis-test.sh
index 8251caf..a41c7e6 100755
--- a/devel/bin/travis-test.sh
+++ b/devel/bin/travis-test.sh
@@ -55,6 +55,13 @@ test_go() {
     go run build.go test
 }
 
+test_python() {
+    cd compiler/python
+    python3 setup.py test
+    cd ../../runtime/python
+    python3 setup.py test
+}
+
 case $CLOWNFISH_HOST in
     perl)
         test_perl
@@ -65,6 +72,9 @@ case $CLOWNFISH_HOST in
     go)
         test_go
         ;;
+    python)
+        test_python
+        ;;
     *)
         echo "unknown CLOWNFISH_HOST: $CLOWNFISH_HOST"
         exit 1


[4/6] lucy-clownfish git commit: Fix Python build under MSVC

Posted by nw...@apache.org.
Fix Python build under MSVC


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/09e9fc65
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/09e9fc65
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/09e9fc65

Branch: refs/heads/master
Commit: 09e9fc654dc4c2e368e189a1dd2c1330fffa301b
Parents: aad2186
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri Aug 26 18:07:52 2016 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Aug 26 19:19:32 2016 +0200

----------------------------------------------------------------------
 compiler/python/setup.py        | 22 ++++++++++++++--------
 compiler/src/CFCPython.c        | 17 ++++++++++++-----
 runtime/common/charmonizer.c    | 20 ++++++++++++++++++--
 runtime/common/charmonizer.main | 20 ++++++++++++++++++--
 runtime/python/setup.py         | 25 ++++++++++++++++++-------
 5 files changed, 80 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/09e9fc65/compiler/python/setup.py
----------------------------------------------------------------------
diff --git a/compiler/python/setup.py b/compiler/python/setup.py
index b9d3e28..7f64c1a 100644
--- a/compiler/python/setup.py
+++ b/compiler/python/setup.py
@@ -38,8 +38,15 @@ compiler_type = distutils.ccompiler.get_default_compiler()
 # There's no public way to get a string representing the compiler executable
 # out of distutils, but the member variable has been in the same place for a
 # long time, so violating encapsulation may be ok.
-compiler_name = " ".join(compiler.compiler)
-make_command = "make" # TODO portability
+if compiler_type == 'unix':
+    compiler_name = "".join(compiler.compiler)
+    make_command  = ["make", "-j"] # TODO portability
+    LIBCFC_NAME   = 'libcfc.a'     # TODO portability
+elif compiler_type == 'msvc':
+    compiler.initialize()
+    compiler_name = compiler.cc
+    make_command  = ["nmake"]
+    LIBCFC_NAME   = 'cfc.lib'
 
 BASE_DIR        = os.path.abspath(os.path.join(os.pardir, os.pardir))
 PARENT_DIR      = os.path.abspath(os.pardir)
@@ -50,7 +57,6 @@ CHARMONIZER_C        = os.path.join(COMMON_SOURCE_DIR, 'charmonizer.c')
 CHARMONIZER_EXE_NAME = compiler.executable_filename('charmonizer')
 CHARMONIZER_EXE_PATH = os.path.join(os.curdir, CHARMONIZER_EXE_NAME)
 CHARMONY_H_PATH      = 'charmony.h'
-LIBCFC_NAME          = 'libcfc.a' # TODO portability
 LIBCFC_PATH          = os.path.abspath(os.path.join(os.curdir, LIBCFC_NAME))
 
 c_filepaths = [os.path.join('src', 'cfc', '_cfc.c')]
@@ -92,9 +98,9 @@ class charmony(_Command):
                 '--enable-c',
                 '--host=python',
                 '--enable-makefile',
-                '--',
-                cflags
             ]
+            if cflags is not None:
+                command.extend(('--', cflags));
             if 'CHARM_VALGRIND' in os.environ:
                 command[0:0] = "valgrind", "--leak-check=yes";
             print(" ".join(command))
@@ -109,17 +115,17 @@ class libcfc(_Command):
         pass
     def run(self):
         self.run_command('charmony')
-        subprocess.check_call([make_command, '-j', 'static'])
+        subprocess.check_call(make_command + ['static'])
         # Touch Python binding file if the library has changed.
         cfc_c = os.path.join('src', 'cfc', '_cfc.c')
-        if newer_group(['libcfc.a'], cfc_c):
+        if newer_group([LIBCFC_NAME], cfc_c):
             os.utime(cfc_c, None)
 
 class my_clean(_clean):
     def run(self):
         _clean.run(self)
         if os.path.isfile("Makefile"):
-            subprocess.check_call([make_command, 'distclean'])
+            subprocess.check_call(make_command + ['distclean'])
         for elem in paths_to_clean:
             for path in glob.glob(elem):
                 print("removing " + path)

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/09e9fc65/compiler/src/CFCPython.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPython.c b/compiler/src/CFCPython.c
index f81cfd4..cbc301c 100644
--- a/compiler/src/CFCPython.c
+++ b/compiler/src/CFCPython.c
@@ -459,6 +459,7 @@ S_write_module_file(CFCPython *self, CFCParcel *parcel, const char *dest) {
 
     CFCClass  **ordered = CFCHierarchy_ordered_classes(self->hierarchy);
     CFCParcel **parcels = CFCParcel_all_parcels();
+    char *privacy_syms       = CFCUtil_strdup("");
     char *callbacks          = S_gen_callbacks(self, parcel, ordered);
     char *type_linkups       = S_gen_type_linkups(self, parcel, ordered);
     char *pound_includes     = CFCUtil_strdup("");
@@ -467,9 +468,12 @@ S_write_module_file(CFCPython *self, CFCParcel *parcel, const char *dest) {
     char *pytype_ready_calls = CFCUtil_strdup("");
     char *module_adds        = CFCUtil_strdup("");
 
-    // Add parcel bootstrapping calls.
+    // Add privacy defines and parcel bootstrapping calls.
     for (size_t i = 0; parcels[i]; ++i) {
         if (!CFCParcel_included(parcels[i])) {
+            const char *privacy_sym = CFCParcel_get_privacy_sym(parcels[i]);
+            privacy_syms = CFCUtil_cat(privacy_syms, "#define ", privacy_sym,
+                                       "\n", NULL);
             const char *prefix = CFCParcel_get_prefix(parcels[i]);
             parcel_boots = CFCUtil_cat(parcel_boots, "    ", prefix,
                                        "bootstrap_parcel();\n", NULL);
@@ -503,6 +507,8 @@ S_write_module_file(CFCPython *self, CFCParcel *parcel, const char *dest) {
     const char pattern[] =
         "%s\n"
         "\n"
+        "%s"
+        "\n"
         "#include \"Python.h\"\n"
         "#include \"cfish_parcel.h\"\n"
         "#include \"CFBind.h\"\n"
@@ -542,10 +548,10 @@ S_write_module_file(CFCPython *self, CFCParcel *parcel, const char *dest) {
         "\n";
 
     char *content
-        = CFCUtil_sprintf(pattern, self->header, pound_includes, callbacks,
-                          helper_mod_name, class_bindings, type_linkups,
-                          last_component, pytype_ready_calls, parcel_boots,
-                          module_adds, self->footer);
+        = CFCUtil_sprintf(pattern, self->header, privacy_syms, pound_includes,
+                          callbacks, helper_mod_name, class_bindings,
+                          type_linkups, last_component, pytype_ready_calls,
+                          parcel_boots, module_adds, self->footer);
 
     char *filepath = CFCUtil_sprintf("%s" CHY_DIR_SEP "_%s.c", dest,
                                      last_component);
@@ -562,6 +568,7 @@ S_write_module_file(CFCPython *self, CFCParcel *parcel, const char *dest) {
     FREEMEM(pound_includes);
     FREEMEM(type_linkups);
     FREEMEM(callbacks);
+    FREEMEM(privacy_syms);
     FREEMEM(ordered);
 }
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/09e9fc65/runtime/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/runtime/common/charmonizer.c b/runtime/common/charmonizer.c
index 558befa..bb15cd3 100644
--- a/runtime/common/charmonizer.c
+++ b/runtime/common/charmonizer.c
@@ -8977,8 +8977,16 @@ cfish_MakeFile_write(cfish_MakeFile *self, chaz_CFlags *extra_link_flags) {
              * library.
              */
             compile_flags = chaz_MakeBinary_get_compile_flags(self->lib);
-            chaz_CFlags_compile_shared_library(compile_flags);
+            if (chaz_CC_msvc_version_num()) {
+                /* Python uses /MT. */
+                chaz_CFlags_append(compile_flags, "/MT");
+            }
+            else {
+                chaz_CFlags_compile_shared_library(compile_flags);
+            }
             chaz_CFlags_add_define(compile_flags, "CFP_CFISH", NULL);
+            /* Test code isn't separated yet. */
+            chaz_CFlags_add_define(compile_flags, "CFP_TESTCFISH", NULL);
         }
     }
 
@@ -9023,8 +9031,16 @@ cfish_MakeFile_write(cfish_MakeFile *self, chaz_CFlags *extra_link_flags) {
              * library.
              */
             compile_flags = chaz_MakeBinary_get_compile_flags(self->test_lib);
-            chaz_CFlags_compile_shared_library(compile_flags);
+            if (chaz_CC_msvc_version_num()) {
+                /* Python uses /MT. */
+                chaz_CFlags_append(compile_flags, "/MT");
+            }
+            else {
+                chaz_CFlags_compile_shared_library(compile_flags);
+            }
             chaz_CFlags_add_define(compile_flags, "CFP_TESTCFISH", NULL);
+            /* Test code isn't separated yet. */
+            chaz_CFlags_add_define(compile_flags, "CFP_CFISH", NULL);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/09e9fc65/runtime/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/runtime/common/charmonizer.main b/runtime/common/charmonizer.main
index cfe8c21..806bdfa 100644
--- a/runtime/common/charmonizer.main
+++ b/runtime/common/charmonizer.main
@@ -398,8 +398,16 @@ cfish_MakeFile_write(cfish_MakeFile *self, chaz_CFlags *extra_link_flags) {
              * library.
              */
             compile_flags = chaz_MakeBinary_get_compile_flags(self->lib);
-            chaz_CFlags_compile_shared_library(compile_flags);
+            if (chaz_CC_msvc_version_num()) {
+                /* Python uses /MT. */
+                chaz_CFlags_append(compile_flags, "/MT");
+            }
+            else {
+                chaz_CFlags_compile_shared_library(compile_flags);
+            }
             chaz_CFlags_add_define(compile_flags, "CFP_CFISH", NULL);
+            /* Test code isn't separated yet. */
+            chaz_CFlags_add_define(compile_flags, "CFP_TESTCFISH", NULL);
         }
     }
 
@@ -444,8 +452,16 @@ cfish_MakeFile_write(cfish_MakeFile *self, chaz_CFlags *extra_link_flags) {
              * library.
              */
             compile_flags = chaz_MakeBinary_get_compile_flags(self->test_lib);
-            chaz_CFlags_compile_shared_library(compile_flags);
+            if (chaz_CC_msvc_version_num()) {
+                /* Python uses /MT. */
+                chaz_CFlags_append(compile_flags, "/MT");
+            }
+            else {
+                chaz_CFlags_compile_shared_library(compile_flags);
+            }
             chaz_CFlags_add_define(compile_flags, "CFP_TESTCFISH", NULL);
+            /* Test code isn't separated yet. */
+            chaz_CFlags_add_define(compile_flags, "CFP_CFISH", NULL);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/09e9fc65/runtime/python/setup.py
----------------------------------------------------------------------
diff --git a/runtime/python/setup.py b/runtime/python/setup.py
index 1d015f5..26380df 100644
--- a/runtime/python/setup.py
+++ b/runtime/python/setup.py
@@ -19,6 +19,7 @@ from distutils.command.clean import clean as _clean
 from distutils.cmd import Command as _Command
 from distutils.dep_util import newer_group
 import distutils.ccompiler
+import distutils.sysconfig
 import os
 import glob
 import platform
@@ -39,14 +40,26 @@ def ext_build_dir(base):
 # CFLAGS.  Add the Python headers include dir to CFLAGS.
 compiler = distutils.ccompiler.new_compiler()
 cflags = sysconfig.get_config_var('CFLAGS')
-cflags = cflags + " -I" + distutils.sysconfig.get_python_inc()
+if cflags is None:
+    cflags = "-I" + distutils.sysconfig.get_python_inc()
+else:
+    cflags = cflags + " -I" + distutils.sysconfig.get_python_inc()
 compiler_type = distutils.ccompiler.get_default_compiler()
 
 # There's no public way to get a string representing the compiler executable
 # out of distutils, but the member variable has been in the same place for a
 # long time, so violating encapsulation may be ok.
-compiler_name = " ".join(compiler.compiler)
-make_command = "make" # TODO portability
+if compiler_type == 'unix':
+    compiler_name = "".join(compiler.compiler)
+    make_command  = ["make", "-j"]   # TODO portability
+    CORELIB_NAME  = 'libclownfish.a' # TODO portability
+    TESTLIB_NAME  = 'libtestcfish.a' # TODO portability
+elif compiler_type == 'msvc':
+    compiler.initialize()
+    compiler_name = compiler.cc
+    make_command  = ["nmake"]
+    CORELIB_NAME  = 'clownfish.lib'
+    TESTLIB_NAME  = 'testcfish.lib'
 
 BASE_DIR        = os.path.abspath(os.path.join(os.pardir, os.pardir))
 PARENT_DIR      = os.path.abspath(os.pardir)
@@ -58,9 +71,7 @@ CHARMONIZER_C        = os.path.join(COMMON_SOURCE_DIR, 'charmonizer.c')
 CHARMONIZER_EXE_NAME = compiler.executable_filename('charmonizer')
 CHARMONIZER_EXE_PATH = os.path.join(os.curdir, CHARMONIZER_EXE_NAME)
 CHARMONY_H_PATH      = 'charmony.h'
-CORELIB_NAME         = 'libclownfish.a' # TODO portability
 CORELIB_PATH         = os.path.abspath(os.path.join(os.curdir, CORELIB_NAME))
-TESTLIB_NAME         = 'libtestcfish.a' # TODO portability
 TESTLIB_PATH         = os.path.abspath(os.path.join(os.curdir, TESTLIB_NAME))
 AUTOGEN_INCLUDE      = os.path.join('autogen', 'include')
 CFC_DIR              = os.path.join(BASE_DIR, 'compiler', 'python')
@@ -128,7 +139,7 @@ class libclownfish(_Command):
     def run(self):
         self.run_command('charmony')
         self.run_cfc()
-        subprocess.check_call([make_command, '-j', 'static'])
+        subprocess.check_call(make_command + ['static'])
 
     def run_cfc(self):
         sys.path.append(CFC_DIR)
@@ -151,7 +162,7 @@ class my_clean(_clean):
     def run(self):
         _clean.run(self)
         if os.path.isfile("Makefile"):
-            subprocess.check_call([make_command, 'distclean'])
+            subprocess.check_call(make_command + ['distclean'])
         for elem in paths_to_clean:
             for path in glob.glob(elem):
                 print("removing " + path)


[3/6] lucy-clownfish git commit: Implement copy-on-incref for Python bindings

Posted by nw...@apache.org.
Implement copy-on-incref for Python bindings


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/335d9188
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/335d9188
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/335d9188

Branch: refs/heads/master
Commit: 335d918817b269d27e6d155cf52608c8fb896c18
Parents: 09e9fc6
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri Aug 26 18:29:17 2016 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Aug 26 19:19:32 2016 +0200

----------------------------------------------------------------------
 runtime/python/cfext/CFBind.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/335d9188/runtime/python/cfext/CFBind.c
----------------------------------------------------------------------
diff --git a/runtime/python/cfext/CFBind.c b/runtime/python/cfext/CFBind.c
index ab0669f..e1ded4e 100644
--- a/runtime/python/cfext/CFBind.c
+++ b/runtime/python/cfext/CFBind.c
@@ -837,6 +837,19 @@ cfish_get_refcount(void *vself) {
 
 cfish_Obj*
 cfish_inc_refcount(void *vself) {
+    cfish_Obj *self = (cfish_Obj*)vself;
+
+    // Handle special cases.
+    if (self->klass == CFISH_STRING) {
+        // Only copy-on-incref Strings get special-cased.  Ordinary
+        // Strings fall through to the general case.
+        if (CFISH_Str_Is_Copy_On_IncRef((cfish_String*)self)) {
+            const char *utf8 = CFISH_Str_Get_Ptr8((cfish_String*)self);
+            size_t size = CFISH_Str_Get_Size((cfish_String*)self);
+            return (cfish_Obj*)cfish_Str_new_from_trusted_utf8(utf8, size);
+        }
+    }
+
     Py_INCREF(vself);
     return (cfish_Obj*)vself;
 }


[5/6] lucy-clownfish git commit: Exit with error code if Python tests fail

Posted by nw...@apache.org.
Exit with error code if Python tests fail


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/6a5fed41
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/6a5fed41
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/6a5fed41

Branch: refs/heads/master
Commit: 6a5fed41fcea5802242765cdc8084fa4b3453553
Parents: 335d918
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri Aug 26 19:02:38 2016 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Aug 26 19:19:32 2016 +0200

----------------------------------------------------------------------
 compiler/python/setup.py | 3 ++-
 runtime/python/setup.py  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/6a5fed41/compiler/python/setup.py
----------------------------------------------------------------------
diff --git a/compiler/python/setup.py b/compiler/python/setup.py
index 7f64c1a..28b0401 100644
--- a/compiler/python/setup.py
+++ b/compiler/python/setup.py
@@ -162,7 +162,8 @@ class test(_Command):
         loader = unittest.TestLoader()
         tests = loader.discover("test")
         test_runner = unittest.runner.TextTestRunner()
-        test_runner.run(tests)
+        if not test_runner.run(tests).wasSuccessful():
+            sys.exit(1)
 
         # restore sys.path
         sys.path = orig_sys_path

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/6a5fed41/runtime/python/setup.py
----------------------------------------------------------------------
diff --git a/runtime/python/setup.py b/runtime/python/setup.py
index 26380df..17eb7f0 100644
--- a/runtime/python/setup.py
+++ b/runtime/python/setup.py
@@ -199,7 +199,8 @@ class test(_Command):
         loader = unittest.TestLoader()
         tests = loader.discover("test")
         test_runner = unittest.runner.TextTestRunner()
-        test_runner.run(tests)
+        if not test_runner.run(tests).wasSuccessful():
+            sys.exit(1)
 
         # restore sys.path
         sys.path = orig_sys_path


[2/6] lucy-clownfish git commit: Fix Python bindings

Posted by nw...@apache.org.
Fix Python bindings


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/aad2186f
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/aad2186f
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/aad2186f

Branch: refs/heads/master
Commit: aad2186fbf819ca0407d5736d6f33a88644f247f
Parents: ace2801
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Fri Aug 26 13:58:53 2016 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Fri Aug 26 19:15:16 2016 +0200

----------------------------------------------------------------------
 runtime/python/cfext/CFBind.c | 3 +--
 runtime/python/setup.py       | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/aad2186f/runtime/python/cfext/CFBind.c
----------------------------------------------------------------------
diff --git a/runtime/python/cfext/CFBind.c b/runtime/python/cfext/CFBind.c
index 536cb1d..ab0669f 100644
--- a/runtime/python/cfext/CFBind.c
+++ b/runtime/python/cfext/CFBind.c
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#define CFP_CFISH
 #define C_CFISH_OBJ
 #define C_CFISH_CLASS
 #define C_CFISH_METHOD
@@ -1124,7 +1123,7 @@ CFISH_BB_To_Host_IMP(cfish_ByteBuf *self, void *vcache) {
     CFISH_UNUSED_VAR(vcache);
     CFISH_BB_To_Host_t super_to_host
         = CFISH_SUPER_METHOD_PTR(CFISH_BYTEBUF, CFISH_BB_To_Host);
-    return super_to_host(self);
+    return super_to_host(self, NULL);
 }
 
 void*

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/aad2186f/runtime/python/setup.py
----------------------------------------------------------------------
diff --git a/runtime/python/setup.py b/runtime/python/setup.py
index 8860d3b..1d015f5 100644
--- a/runtime/python/setup.py
+++ b/runtime/python/setup.py
@@ -201,8 +201,8 @@ clownfish_extension = Extension('clownfish._clownfish',
                                     os.curdir,
                                  ],
                                  extra_link_args = [
-                                    CORELIB_PATH,
                                     TESTLIB_PATH,
+                                    CORELIB_PATH,
                                  ],
                                  sources = c_filepaths)