Skip to content

Commit

Permalink
Fix merge messup
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
  • Loading branch information
noxdafox committed May 5, 2021
1 parent c7b462d commit decccc5
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 31 deletions.
35 changes: 26 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
PYTHON ?= python
CLIPS_VERSION ?= 6.40
CLIPS_SOURCE_URL ?= "https://sourceforge.net/projects/clipsrules/files/CLIPS/6.40_Beta_3/clips_core_source_640.zip "
CLIPS_SOURCE_URL ?= "https://sourceforge.net/projects/clipsrules/files/CLIPS/6.40/clips_core_source_640.zip "
MAKEFILE_NAME ?= makefile
SHARED_LIBRARY_DIR ?= /usr/lib

# platform detection
PLATFORM = $(shell uname -s)

.PHONY: clips clipspy test install clean

all: clips_source clips clipspy
Expand All @@ -12,24 +15,38 @@ clips_source:
wget -O clips.zip $(CLIPS_SOURCE_URL)
unzip -jo clips.zip -d clips_source

ifeq ($(PLATFORM),Darwin) # macOS
clips: clips_source
$(MAKE) -f $(MAKEFILE_NAME) -C clips_source \
CFLAGS="-std=c99 -O3 -fno-strict-aliasing -fPIC" \
LDLIBS="-lm"
ld clips_source/*.o -lm -dylib -arch x86_64 \
-o clips_source/libclips.so
else
clips: clips_source
$(MAKE) -C clips_source -f $(MAKEFILE_NAME) \
CFLAGS='-std=c99 -O3 -fno-strict-aliasing -fPIC'
$(MAKE) -f $(MAKEFILE_NAME) -C clips_source \
CFLAGS="-std=c99 -O3 -fno-strict-aliasing -fPIC" \
LDLIBS="-lm -lrt"
ld -G clips_source/*.o -o clips_source/libclips.so
endif

clipspy: clips
$(PYTHON) setup.py build_ext --include-dirs clips_source \
--library-dirs clips_source
$(PYTHON) setup.py build_ext

test: clipspy
cp build/lib.*/clips/_clips*.so clips
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:clips_source \
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:clips_source \
$(PYTHON) -m pytest -v

install: clipspy
cp clips_source/libclips.so \
install-clips: clips
install -d $(SHARED_INCLUDE_DIR)/
install -m 644 clips_source/clips.h $(SHARED_INCLUDE_DIR)/
install -d $(SHARED_INCLUDE_DIR)/clips
install -m 644 clips_source/*.h $(SHARED_INCLUDE_DIR)/clips/
install -d $(SHARED_LIBRARY_DIR)/
install -m 644 clips_source/libclips.so \
$(SHARED_LIBRARY_DIR)/libclips.so.$(CLIPS_VERSION)
ln -s $(SHARED_LIBRARY_DIR)/libclips.so.$(CLIPS_VERSION) \
ln -s $(SHARED_LIBRARY_DIR)/libclips.so.$(CLIPS_VERSION) \
$(SHARED_LIBRARY_DIR)/libclips.so.6
ln -s $(SHARED_LIBRARY_DIR)/libclips.so.$(CLIPS_VERSION) \
$(SHARED_LIBRARY_DIR)/libclips.so
Expand Down
9 changes: 9 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ Most of the distributions should be supported.
$ [sudo] pip install clipspy
Windows
+++++++

CLIPSPy comes as a wheel for most of the Python versions and architectures.

.. code:: batch
> pip install clipspy
Building from sources
+++++++++++++++++++++

Expand Down
21 changes: 2 additions & 19 deletions clips/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,25 +160,8 @@ def unmake(self):
if ret != lib.UIE_NO_ERROR:
raise CLIPSError(self._env, code=ret)

def make_instance(self, command):
"""Create and initialize an instance of a user-defined class.

command must be a string in the form:
(<instance-name> of <class-name> <slot-override>*)
<slot-override> :== (<slot-name> <constant>*)
Python equivalent of the CLIPS make-instance command.
"""
ist = lib.EnvMakeInstance(self._env, command.encode())
if ist == ffi.NULL:
raise CLIPSError(self._env)

return Instance(self._env, ist)


class Class(object):
class Class:
"""A Class is a template for creating instances of objects.
In CLIPS, Classes are defined via the (defclass) statement.
Expand Down Expand Up @@ -376,7 +359,7 @@ def undefine(self):
self._env = self._cls = None


class ClassSlot(object):
class ClassSlot:
"""A Class Instances organize the information within Slots.
Slots might restrict the type or amount of data they store.
Expand Down
4 changes: 2 additions & 2 deletions clips/facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def modify_slots(self, **slots):
raise CLIPSError(self._env, code=lib.FBError(self._env))


class Template(object):
class Template:
"""A Fact Template is a formal representation of the fact data structure.
In CLIPS, Templates are defined via the (deftemplate) function.
Expand Down Expand Up @@ -316,7 +316,7 @@ def undefine(self):
self._env = self._tpl = None


class TemplateSlot(object):
class TemplateSlot:
"""Template Facts organize the information within Slots.
Slots might restrict the type or amount of data they store.
Expand Down
2 changes: 1 addition & 1 deletion clips/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def name(self):
return ffi.string(lib.DefmoduleName(self._mdl)).decode()


class Global(object):
class Global:
"""A CLIPS global variable.
In CLIPS, Globals are defined via the (defglobal) statement.
Expand Down

0 comments on commit decccc5

Please sign in to comment.