Skip to content

Commit

Permalink
Fixes for ABCL and CLISP. Report build status and coverage in README …
Browse files Browse the repository at this point in the history
…using Travis CI.
  • Loading branch information
metawilm committed Apr 22, 2017
1 parent f273793 commit b195312
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 50 deletions.
70 changes: 70 additions & 0 deletions .travis.yml
@@ -0,0 +1,70 @@
language: common-lisp
sudo: required

env:
matrix:
- LISP=abcl CATCH=1
- LISP=abcl NOCATCH=1

- LISP=allegro CATCH=1
- LISP=allegro NOCATCH=1

# Error outside our control:
# The command "curl https://raw.githubusercontent.com/luismbo/cl-travis/master/install.sh | bash" failed and exited with 1 during .
# - LISP=allegromodern

# Error outside our control: CCL 1.10 and cl-coveralls don't work together (see also cl-coveralls README):
# [package cl-coveralls] Not supported implementation: Clozure Common Lisp Version 1.10-r16196 (LinuxX8664)
# Therefore use CCL without coverage
#- LISP=ccl COVERALLS=true
- LISP=ccl

- LISP=clisp

# Error outside our control:
# /home/travis/.cim/bin/cl: 9: .: Can't open /home/travis/.cim/config/current.7469
#- LISP=cmucl

- LISP=ecl CATCH=1
- LISP=ecl NOCATCH=1

- LISP=sbcl COVERALLS=true

install:
# Install cl-travis
- curl https://raw.githubusercontent.com/metawilm/cl-travis/dev/install.sh | bash
#- curl https://raw.githubusercontent.com/luismbo/cl-travis/master/install.sh | bash
# Newest Dexador needed for cl-coveralls -- https://github.com/fukamachi/cl-coveralls/issues/10
- git clone https://github.com/fukamachi/dexador.git ~/lisp/dexador
# Our project
- git clone https://github.com/metawilm/cl-python.git ~/lisp/cl-python

script:
# Use SBCL for coverage
# Let CLISP print a backtrace, because it errs

- cl -e '(in-package :cl-user)'
-e '(print *package*)'
-e '(ql:quickload :ptester)'
-e '#+sbcl (ql:quickload :cl-coveralls)'
-e '#+sbcl (defmacro outer (&body body) `(coveralls:with-coveralls () ,@body))'
-e '#-sbcl (defmacro outer (&body body) `(progn ,@body))'
-e '(defun do-test ()
(ql:quickload :clpython)
(ql:quickload :clpython/test)
(funcall (read-from-string "clpython.test:run-tests")))'
-e '(when (asdf/os:getenv "NOCATCH")
(do-test))'
-e '(unless (asdf/os:getenv "NOCATCH")
(let (ret normal-exit)
(unwind-protect
(outer
(setf ret (do-test))
(setf normal-exit t))
(cond ((and normal-exit (eq ret t)) (warn "Test suite SUCCESS") (uiop:quit 0))
(normal-exit (warn "Test suite FAIL") (uiop:quit -1))
(t (warn "Unexpected abort during test suite") (uiop:quit -1))))))'

notifications:
email:
- metawilm@gmail.com
39 changes: 14 additions & 25 deletions README.md
Expand Up @@ -6,34 +6,23 @@ With CLPython you can run Python programs in a Lisp environment. Libraries writt
in Lisp are available to Python code, and Python libraries can be accessed by Lisp code.
Also Python and Lisp code can be mixed.

CLPython is developed by Willem Broekema and is released as open source under the
[LLGPL](http://opensource.franz.com/preamble.html).

The project was started in 2006, and is currently (2013) not under active development anymore.

The git address changed on Feb 4, 2014 from: github.com/franzinc/cl-python.git to: github.com/metawilm/cl-python.git

Documentation
-------------

Please see the [Introduction](http://common-lisp.net/project/clpython/index.html) and
For rough documentation, please see the [Introduction](http://common-lisp.net/project/clpython/index.html) and
[Manual](http://common-lisp.net/project/clpython/manual.html) on *common-lisp.net*.

Requirements
------------

CLPython runs successfully on:
To install using QuickLisp: `(ql:quickload "clpython")`

* [Allegro CL 8.2 (ANSI and Modern)](http://franz.com/products/allegrocl/)
* [Clozure CL 1.5-r13651](http://clozure.com/clozurecl.html)
* [CMUCL 20b-pre2](http://www.cons.org/cmucl/)
* [ECL (git: 2011.02.11)](http://ecls.sourceforge.net/)
* [LispWorks 6.0](http://www.lispworks.com/)
* [SBCL 1.0.45](http://sbcl.sourceforge.net/)
CLPython is developed by Willem Broekema and is released as open source under the [LLGPL](http://opensource.franz.com/preamble.html).
The project was started in 2006, and is since 2013 not under active development anymore.

Install
-------
| Common Lisp Implementation | Build + Test Status | |
|:-:|:-:|:-:|
| [ABCL](https://common-lisp.net/project/armedbear/) | [![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-python&branch=dev&envContains=abcl+CATCH&label=ABCL)](https://travis-ci.org/metawilm/cl-python) | Fails due to NullPointerException |
| [Allegro CL](http://franz.com/products/allegrocl/) | [![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-python&branch=dev&envContains=allegro+CATCH&label=Allegro+CL)](https://travis-ci.org/metawilm/cl-python) | |
| [Clozure CL](http://clozure.com/clozurecl.html) | [![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-python&branch=dev&envContains=ccl&label=Clozure+CL)](https://travis-ci.org/metawilm/cl-python) | |
| [CLISP](http://clisp.sourceforge.net) | [![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-python&branch=dev&envContains=clisp&label=CLISP)](https://travis-ci.org/metawilm/cl-python) | Fails due to stack overflow |
| [CMUCL](http://www.cons.org/cmucl/) | ? | |
| [ECL](http://ecls.sourceforge.net/) | [![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-python&branch=dev&envContains=ecl+CATCH&label=ECL)](https://travis-ci.org/metawilm/cl-python) | |
| [LispWorks](http://www.lispworks.com/) | ? | |
| [SBCL](http://sbcl.sourceforge.net/) | [![Build Status](https://travis-build-job-badge.herokuapp.com/badge?user=metawilm&repo=cl-python&branch=dev&envContains=sbcl&label=SBCL)](https://travis-ci.org/metawilm/cl-python) [![Coverage Status](https://coveralls.io/repos/metawilm/cl-python/badge.svg?branch=dev)](https://coveralls.io/r/metawilm/cl-python?branch=dev) | |

Using QuickLisp:

(ql:quickload "clpython")
2 changes: 1 addition & 1 deletion clpython.asd
Expand Up @@ -83,7 +83,7 @@

(defsystem "clpython/runtime"
:description "Python runtime environment"
:depends-on ("clpython/basic" "closer-mop" #+ecl "cl-custom-hash-table" "cl-fad")
:depends-on ("clpython/basic" "closer-mop" #+(or abcl clisp ecl) "cl-custom-hash-table" "cl-fad")
:components ((:module "runtime"
:serial t
:components ((:file "rsetup" )
Expand Down
1 change: 0 additions & 1 deletion compiler/compiler.lisp
Expand Up @@ -179,7 +179,6 @@ ARGS are the command-line args, available as `sys.argv'; can be a string (which
(warn "Compilation failed: ~S" c)
(return-from compilation nil))))
(compile nil get-module-f)))
(declare (ignore warnings-p))
(cond (func
(setf fc func))
(t
Expand Down
5 changes: 3 additions & 2 deletions parser/lexer.lisp
Expand Up @@ -603,9 +603,10 @@ Used by compiler to generate 'forbidden' identfiers.")
Returns character or NIL."
(when (plusp (length python-name))
(let* ((division-char (checking-reader-conditionals
#+(or allegro ccl sbcl) #\_
#+(or allegro ccl clisp sbcl) #\_
#+(or ecl cmu) nil
#+lispworks #\- ))
#+lispworks #\-
#+abcl (error "Looking up Unicode character by name is not supported on ABCL")))
(lisp-char-name (if division-char
(substitute division-char #\Space python-name)
python-name)))
Expand Down
15 changes: 8 additions & 7 deletions runtime/classes.lisp
Expand Up @@ -605,8 +605,8 @@
(defparameter *create-simple-lambdas-for-python-functions*
(checking-reader-conditionals
#+(or allegro lispworks) nil
#+sbcl t
#-(or allegro lispworks sbcl) t)
#+(or abcl sbcl) t
#-(or abcl allegro lispworks sbcl) t)
"Whether Python function are real CLOS funcallable instances, or just normal lambdas.
Note that in the latter case, functions miss their name and attribute dict, but should
otherwise work well.")
Expand All @@ -630,7 +630,8 @@ otherwise work well.")
;; which is not quite kosher.
(:method ((x function)) x))

(defclass py-function (standard-generic-function dicted-object)
(defclass py-function (#-clisp standard-generic-function
dicted-object)
;; mop:funcallable-standard-class defines :name initarg, but how to to access it portably...
((fname :initarg :fname :initform nil :accessor py-function-name)
(context-name :initarg :context-name :initform nil :accessor py-function-context-name)
Expand Down Expand Up @@ -1341,7 +1342,6 @@ Basically the Python equivalent of ENSURE-CLASS."

(def-py-method py-type.__nonzero__ (cls)
;; to make e.g. "if str: ..." work
(declare (ignore cls))
+the-true+)

(def-py-method py-type.__dict__ :attribute-read (cls)
Expand Down Expand Up @@ -4025,7 +4025,7 @@ finished; F will then not be called again."
+the-false+)))
(setf (gethash ',syntax *binary-comparison-funcs-ht*) ',func)))

#+ecl
#+(or abcl ecl)
(defvar *py-id-entries* (make-weak-key-hash-table))

(defun py-id (x)
Expand All @@ -4035,9 +4035,10 @@ fixed id during the object's lifetime."
(checking-reader-conditionals
#+allegro (excl:lispval-to-address x)
#+ccl (ccl:%address-of x)
#+clisp (system::address-of x)
#+cmu (kernel:get-lisp-obj-address x)
#+ecl (or #1=(gethash x *py-id-entries*)
(setf #1# (hash-table-count *py-id-entries*)))
#+(or abcl ecl) (or #1=(gethash x *py-id-entries*)
(setf #1# (hash-table-count *py-id-entries*)))
#+lispworks (system:object-address x)
#+sbcl (sb-kernel:get-lisp-obj-address x)))

Expand Down
12 changes: 7 additions & 5 deletions runtime/dictattr.lisp
Expand Up @@ -66,8 +66,10 @@

(defconstant-once +py-class-classname-slot-name+
(checking-reader-conditionals
#+abcl 'mop::name
#+allegro 'excl::name
#+ccl 'ccl::name
#+clisp 'clos::$classname
#+cmu 'pcl::name
#+ecl 'clos::name
#+lispworks 'clos::name
Expand All @@ -76,16 +78,16 @@
(eval-when (:compile-toplevel :load-toplevel :execute)

(defconstant +use-standard-instance-access+
(checking-reader-conditionals
#+ecl nil
#+(or allegro ccl cmu lispworks sbcl) t))
(checking-reader-conditionals
#+(or abcl ecl) nil ;; Need to look into ABCL, got NullPointerException in test case
#+(or allegro ccl clisp cmu lispworks sbcl) t))

(register-feature :clpython-use-standard-instance-access +use-standard-instance-access+)

(defconstant +use-standard-instance-access-setf+
(checking-reader-conditionals
#+(or allegro ccl lispworks sbcl) t
#+(or cmu ecl) nil ;; these lack (SETF STANDARD-INSTANCE-ACCESS)
#+(or allegro ccl clisp lispworks sbcl) t
#+(or abcl cmu ecl) nil ;; these lack (SETF STANDARD-INSTANCE-ACCESS)
))

(register-feature :clpython-use-standard-instance-access-setf +use-standard-instance-access-setf+))
Expand Down
2 changes: 1 addition & 1 deletion runtime/metaclass.lisp
Expand Up @@ -110,7 +110,7 @@
(defun make-py-hash-table ()
(make-hash-table :test 'py-hash-table-test)))

#+ecl
#+(or abcl clisp ecl)
(cl-custom-hash-table:define-custom-hash-table-constructor
make-py-hash-table :test py-==->lisp-val :hash-function py-hash)

Expand Down
8 changes: 5 additions & 3 deletions test/parser-test.lisp
Expand Up @@ -313,16 +313,18 @@ if 1 > \\
(test-error (ps "\\1" t) :condition-type '{SyntaxError})
;; unicode

#-ecl
#-(or abcl ecl)
(test-equal (ps (concatenate 'string "u'\\N{" #1="Latin Small Letter Y With Acute" "}'") t)
`([literal-expr] :string
,(coerce (list (or (clpython.parser::lisp-char-by-python-name #1#)
(error "Unicode char ~A not available in this Lisp?" #1#)))
'string)))
#-(or ecl lispworks) ;; Lispworks has no names for chars > 255
#-(or abcl ecl lispworks) ;; Lispworks has no names for chars > 255
(test-equal (ps "u'\\N{latin capital letter l with stroke}'" t)
`([literal-expr] :string
,(coerce (list (name-char "latin_capital_letter_l_with_stroke")) 'string)))
,(coerce (list (or (name-char "latin_capital_letter_l_with_stroke")
(error "No name-char for unicode chars in this implementation?")))
'string)))
#-ecl
(test-equal (ps "u'\\u0141 \\U00000141'" t)
`([literal-expr] :string
Expand Down
8 changes: 5 additions & 3 deletions test/tsetup.lisp
Expand Up @@ -151,10 +151,12 @@ seems to give implementations some freedom here. (In practice: Allegro=NIL, LisW
(run-mod-string-test)
(run-mod-math-test)
(run-mod-operator-test)

(setf final-result (not (plusp *test-unexpected-failures*))
successes *test-successes*
errors *test-errors*
unexpected-failures *test-unexpected-failures*))
(values final-result
successes errors unexpected-failures)))

(let ((vals (list final-result successes errors unexpected-failures)))
(format t "~%Return values of RUN-TESTS: ~A" vals)
(values-list vals))))
4 changes: 2 additions & 2 deletions util/utils.lisp
Expand Up @@ -110,7 +110,7 @@ If the stream length can not be determined (e.g. for standard input), all availa
"Break unless the body contains exactly one form. Based on idea from Steve Haflich."
(let ((num (length body)))
(unless (= num 1)
(error "A CHECKING-READER-CONDITIONALS expression returned ~r forms: ~s" num whole))
(error "A CHECKING-READER-CONDITIONALS expression returned ~r forms, in: ~A" num (or *compile-file-truename* *load-truename*)))
(car body)))

(defmacro named-function (name lambda-form)
Expand Down Expand Up @@ -247,7 +247,7 @@ See function ALIST-VS-HT.")
(check-type code integer)
(checking-reader-conditionals
#+allegro (excl:exit code :quiet t)
#+cmu (ext:quit code)
#+(or clisp cmu) (ext:quit code)
#+lispworks (lw:quit :status code)
#+sbcl (sb-ext:exit :code (or code 0))
#+(or openmcl mcl) (ccl::quit)
Expand Down

0 comments on commit b195312

Please sign in to comment.