-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed: Bundles compilation and pyml update
- %.cmx: %.cmo dependency (with .ml files that do not have .mli, compiling the .ml into .cmo or into .cmx both write to the same .cmi file, so that cannot be done concurrently) - untarred pyml distribution to ease updates - Python exception catched in pycocci interface
- Loading branch information
1 parent
cfb9c00
commit 62f2df8
Showing
27 changed files
with
5,185 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pyml-20160621 | ||
pyml-current | ||
.prepare |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Copyright 1992-2016 The FreeBSD Project. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in | ||
the documentation and/or other materials provided with the | ||
distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS | ||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | ||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
The views and conclusions contained in the software and documentation | ||
are those of the authors and should not be interpreted as representing | ||
official policies, either expressed or implied, of the FreeBSD | ||
Project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
description = "py.ml: OCaml bindings for Python" | ||
requires = "unix" | ||
version = "20160620" | ||
archive(byte) = "pyml.cma" | ||
archive(native) = "pyml.cmxa" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
OCAMLFIND=ocamlfind | ||
|
||
HAVE_OCAMLFIND=$(shell \ | ||
if $(OCAMLFIND) query -help >/dev/null 2>&1; then \ | ||
echo yes; \ | ||
else \ | ||
echo no; \ | ||
fi \ | ||
) | ||
|
||
OCAMLC=$(shell \ | ||
if [ "$(HAVE_OCAMLFIND)" = yes ]; then \ | ||
echo $(OCAMLFIND) ocamlc; \ | ||
elif ocamlc.opt -version >/dev/null 2>&1; then \ | ||
echo ocamlc.opt; \ | ||
else \ | ||
echo ocamlc; \ | ||
fi \ | ||
) | ||
OCAMLOPT=$(shell \ | ||
if [ "$(HAVE_OCAMLFIND)" = yes ]; then \ | ||
echo $(OCAMLFIND) ocamlopt; \ | ||
elif ocamlopt.opt -version >/dev/null 2>&1; then \ | ||
echo ocamlopt.opt; \ | ||
else \ | ||
echo ocamlopt; \ | ||
fi \ | ||
) | ||
OCAMLMKLIB=$(shell \ | ||
if [ "$(HAVE_OCAMLFIND)" = yes ]; then \ | ||
echo $(OCAMLFIND) ocamlmklib; \ | ||
else \ | ||
echo ocamlmklib; \ | ||
fi \ | ||
) | ||
OCAMLDEP=$(shell \ | ||
if [ "$(HAVE_OCAMLFIND)" = yes ]; then \ | ||
echo $(OCAMLFIND) ocamldep; \ | ||
else \ | ||
echo ocamldep; \ | ||
fi \ | ||
) | ||
OCAMLDOC=$(shell \ | ||
if [ "$(HAVE_OCAMLFIND)" = yes ]; then \ | ||
echo $(OCAMLFIND) ocamldoc; \ | ||
else \ | ||
echo ocamldoc; \ | ||
fi \ | ||
) | ||
|
||
MODULES=pyml_compat pytypes pywrappers py pycaml_compat | ||
GENERATED=pyml_dlsyms.inc pyml_wrappers.inc pyml.h | ||
|
||
VERSION=$(shell date "+%Y%m%d") | ||
|
||
OCAMLLIBFLAGS=-cclib "-L. -lpyml_stubs" | ||
|
||
OCAMLLIBFLAGSNATIVE=$(OCAMLLIBFLAGS) | ||
OCAMLLIBFLAGSBYTECODE=-custom $(OCAMLLIBFLAGS) | ||
|
||
OCAMLVERSION=$(shell $(OCAMLC) -version) | ||
|
||
PYML_COMPAT=$(shell \ | ||
if [ "$(OCAMLVERSION)" "<" 4.00.0 ]; then \ | ||
echo pyml_compat312.ml; \ | ||
elif [ "$(OCAMLVERSION)" "<" 4.03.0 ]; then \ | ||
echo pyml_compat400.ml; \ | ||
else \ | ||
echo pyml_compat403.ml; \ | ||
fi \ | ||
) | ||
|
||
all: py.cmi pycaml_compat.cmi pyml.cma pyml.cmxa pyml.cmxs doc | ||
|
||
.PHONY: all tests tests.bytecode clean install | ||
|
||
tests: pyml_tests | ||
./pyml_tests | ||
|
||
tests.bytecode: pyml_tests.bytecode | ||
./pyml_tests.bytecode | ||
|
||
doc: py.mli pycaml_compat.mli pywrappers.ml | ||
mkdir -p $@ | ||
$(OCAMLDOC) -html -d $@ $^ | ||
touch $@ | ||
|
||
install: | ||
$(OCAMLFIND) install pyml \ | ||
py.mli \ | ||
py.cmi pytypes.cmi pywrappers.cmi pycaml_compat.cmi \ | ||
py.cmx pytypes.cmx pywrappers.cmx pycaml_compat.cmx \ | ||
pyml.cma pyml.cmxa pyml.cmxs pyml.a \ | ||
libpyml_stubs.a dllpyml_stubs.so \ | ||
META | ||
|
||
ifneq ($(MAKECMDGOALS),clean) | ||
-include .depend | ||
endif | ||
|
||
.depend: $(MODULES:=.ml) $(MODULES:=.mli) pyml_tests.ml | ||
$(OCAMLDEP) $^ >$@ | ||
|
||
clean: | ||
rm -f py.cmi py.cmx py.cmo py.a py.o | ||
rm -f pyml.cma pyml.cmxa | ||
rm -f pytypes.cmi pytypes.cmo pytypes.cmx pytypes.o | ||
rm -f pywrappers.mli pywrappers.ml pywrappers.cmi pywrappers.cmo | ||
rm -f pywrappers.cmx pywrappers.o | ||
rm -f pyml_stubs.o | ||
rm -f generate.cmi generate.cmx | ||
rm -f pyml_compat.ml pyml_compat.cmi pyml_compat.cmo pyml_compat.cmx | ||
rm -f pyml_compat.o | ||
rm -f pycaml_compat.cmi pycaml_compat.cmx pycaml_compat.cmo | ||
rm -f pycaml_compat.a pycaml_compat.o | ||
rm -f pyml_tests.cmi pyml_tests.cmx pyml_tests.cmo pyml_tests.a | ||
rm -f pyml_tests.o | ||
rm -f $(GENERATED) | ||
rm -f .depend | ||
rm -rf doc | ||
|
||
tarball: | ||
mkdir pyml-$(VERSION)/ | ||
cp Makefile pyml_compat312.ml pyml_compat400.ml pyml_compat403.ml \ | ||
pyml_compat.mli \ | ||
generate.ml py.ml py.mli pyml_stubs.c pytypes.ml pytypes.mli \ | ||
pyml_tests.ml test.py \ | ||
pycaml_compat.ml pycaml_compat.mli README LICENSE META \ | ||
pyml-$(VERSION)/ | ||
rm -f pyml-$(VERSION).tar.gz | ||
tar -czf pyml-$(VERSION).tar.gz pyml-$(VERSION)/ | ||
rm -rf pyml-$(VERSION)/ | ||
|
||
generate: pyml_compat.cmx generate.cmx | ||
$(OCAMLOPT) $^ -o $@ | ||
|
||
generate.cmx: generate.ml pyml_compat.cmi pyml_compat.cmx | ||
|
||
pywrappers.ml pyml_wrappers.inc: generate | ||
./generate | ||
|
||
pyml_wrappers.inc: pywrappers.ml | ||
|
||
pywrappers.mli: pywrappers.ml pytypes.cmi | ||
$(OCAMLC) -i $< >$@ | ||
|
||
pyml_tests: py.cmi pyml.cmxa pyml_tests.cmx | ||
$(OCAMLOPT) $(OCAMLLDFLAGS) unix.cmxa pyml.cmxa pyml_tests.cmx -o $@ | ||
|
||
pyml_tests.bytecode: py.cmi pyml.cma pyml_tests.cmo | ||
$(OCAMLC) unix.cma pyml.cma pyml_tests.cmo -o $@ | ||
|
||
pyml_compat.ml: $(PYML_COMPAT) | ||
cp $< $@ | ||
|
||
pyml_compat.cmx: pyml_compat.cmi | ||
|
||
%.cmi: %.mli | ||
$(OCAMLC) $(OCAMLCFLAGS) -c $< -o $@ | ||
|
||
%.cmo: %.ml | ||
$(OCAMLC) $(OCAMLCFLAGS) -c $< -o $@ | ||
|
||
%.cmx: %.ml | ||
$(OCAMLOPT) $(OCAMLCFLAGS) -c $< -o $@ | ||
|
||
pyml_stubs.o: pyml_stubs.c pyml_wrappers.inc | ||
$(OCAMLC) -c $< -o $@ | ||
|
||
pyml.cma: $(MODULES:=.cmo) libpyml_stubs.a | ||
$(OCAMLC) $(OCAMLLIBFLAGSBYTECODE) -a $(MODULES:=.cmo) -o $@ | ||
|
||
pyml.cmxa: $(MODULES:=.cmx) libpyml_stubs.a | ||
$(OCAMLOPT) $(OCAMLLIBFLAGSNATIVE) -a $(MODULES:=.cmx) -o $@ | ||
|
||
pyml.cmxs: $(MODULES:=.cmx) libpyml_stubs.a | ||
$(OCAMLOPT) $(OCAMLLIBFLAGSNATIVE) -shared $(MODULES:=.cmx) -o $@ | ||
|
||
libpyml_stubs.a: pyml_stubs.o | ||
$(OCAMLMKLIB) -o pyml_stubs $< |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
``py.ml``: OCaml bindings for Python | ||
==================================== | ||
|
||
``py.ml`` provides OCaml bindings for ``Python 2`` and ``Python | ||
3``. This library subsumes the ``pycaml`` library, which is no longer | ||
actively maintained. | ||
|
||
*Homepage:* http://pyml.gforge.inria.fr | ||
|
||
*Documentation:* http://pyml.gforge.inria.fr/doc | ||
|
||
*Git:* ``git clone http://pyml.gforge.inria.fr/git`` | ||
|
||
*Git Repository Browser:* http://pyml.gforge.inria.fr/browser | ||
|
||
*Tracker for bug reports and feature requests:* | ||
http://pyml.gforge.inria.fr/tracker | ||
|
||
*OPAM:* :: | ||
|
||
opam remote add pyml http://pyml.gforge.inria.fr | ||
opam install pyml | ||
|
||
The Python library is linked at runtime and the same executable can be | ||
run in a Python 2 or a Python 3 environment. ``py.ml`` does not | ||
require any Python library at compile time, nor any other | ||
dependency. Bindings provide high level functions to convert strings | ||
back and forth between OCaml and Python that handle Unicode strings | ||
transparently (``Py.String.of_string`` and ``Py.String.to_string``). | ||
|
||
Bindings are split in three modules: | ||
|
||
- ``Pywrappers`` provides low-level bindings, which follow closely the | ||
conventions of the C bindings for Python. Submodules | ||
``Pywrappers.Python2`` and ``Pywrappers.Python3`` contain version-specific | ||
bindings. | ||
|
||
- ``Py`` provides the initialization functions and some high-level | ||
bindings, with error handling and naming conventions closer to OCaml | ||
usages. | ||
|
||
- ``Pycaml_compat`` provides a signature close to the old `Pycaml` | ||
module, so as to ease migration. |
Oops, something went wrong.