Skip to content

Commit 621a9a6

Browse files
committed
initial import
0 parents  commit 621a9a6

13 files changed

+1833
-0
lines changed

LICENSE

+504
Large diffs are not rendered by default.

MANIFEST.in

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
recursive-include src *.c *.h
2+
include MANIFEST.in python.lua LICENSE Makefile

Makefile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# Simple wrapper for setup.py script
3+
#
4+
5+
DESTDIR=/
6+
PYTHON=python
7+
8+
prefix=/usr
9+
bindir=$(prefix)/bin
10+
11+
all:
12+
$(PYTHON) setup.py build
13+
14+
install:
15+
$(PYTHON) setup.py install \
16+
--root=$(DESTDIR) \
17+
--prefix=$(prefix) \
18+
--install-scripts=$(bindir)
19+
20+
dist:
21+
$(PYTHON) setup.py sdist
22+
23+
rpm:
24+
$(PYTHON) setup.py bdist_rpm
25+

PKG-INFO

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Metadata-Version: 1.0
2+
Name: lunatic-python
3+
Version: 1.0
4+
Summary: Two-way bridge between Python and Lua
5+
Home-page: http://labix.org/lunatic-python
6+
Author: Gustavo Niemeyer
7+
Author-email: [email protected]
8+
License: LGPL
9+
Description: Lunatic Python is a two-way bridge between Python and Lua, allowing these
10+
languages to intercommunicate. Being two-way means that it allows Lua inside
11+
Python, Python inside Lua, Lua inside Python inside Lua, Python inside Lua
12+
inside Python, and so on.
13+
14+
Platform: UNKNOWN

README

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
this is a fork of Lunatic Python, which can be found on the 'net at http://labix.org/lunatic-python.
2+
3+
Sadly, Lunatic Python is very much outdated and won't work with either a current Python or Lua.
4+
5+
This is an updated version of lunatic-python that works with Python 2.7 and Lua 5.1.
6+
I tried contacting the original author of Lunatic Python, but got no response.

python.lua

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
local path = os.getenv("LUA_SOPATH")
2+
if path then
3+
func = loadlib(path.."/lua-python.so", "luaopen_python")
4+
if func then
5+
func()
6+
return
7+
end
8+
end
9+
local modmask = "/usr/lib/python%d.%d/site-packages/lua-python.so"
10+
local loaded = false
11+
for i = 10, 2, -1 do
12+
for j = 10, 2, -1 do
13+
func = loadlib(string.format(modmask, i, j), "luaopen_python")
14+
if func then
15+
loaded = true
16+
func()
17+
break
18+
end
19+
end
20+
end
21+
if not loaded then
22+
error("unable to find python module")
23+
end

setup.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[bdist_rpm]
2+
doc_files = python.lua LICENSE
3+
use_bzip2 = 1

setup.py

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/python
2+
from distutils.core import setup, Extension
3+
from distutils.sysconfig import get_python_lib, get_python_version
4+
import os
5+
6+
if os.path.isfile("MANIFEST"):
7+
os.unlink("MANIFEST")
8+
9+
# You may have to change these
10+
PYLIBS = ["python"+get_python_version(), "pthread", "util"]
11+
PYLIBDIR = [get_python_lib(standard_lib=True)+"/config"]
12+
LUALIBS = ["lua"]
13+
LUALIBDIR = []
14+
15+
setup(name="lunatic-python",
16+
version = "1.0",
17+
description = "Two-way bridge between Python and Lua",
18+
author = "Gustavo Niemeyer",
19+
author_email = "[email protected]",
20+
url = "http://labix.org/lunatic-python",
21+
license = "LGPL",
22+
long_description =
23+
"""\
24+
Lunatic Python is a two-way bridge between Python and Lua, allowing these
25+
languages to intercommunicate. Being two-way means that it allows Lua inside
26+
Python, Python inside Lua, Lua inside Python inside Lua, Python inside Lua
27+
inside Python, and so on.
28+
""",
29+
ext_modules = [
30+
Extension("lua-python",
31+
["src/pythoninlua.c", "src/luainpython.c"],
32+
library_dirs=PYLIBDIR,
33+
libraries=PYLIBS,
34+
extra_compile_args=["-rdynamic"],
35+
extra_link_args=["-rdynamic"]),
36+
Extension("lua",
37+
["src/pythoninlua.c", "src/luainpython.c"],
38+
library_dirs=LUALIBDIR,
39+
libraries=LUALIBS,
40+
extra_compile_args=["-rdynamic"],
41+
extra_link_args=["-rdynamic"]),
42+
],
43+
)

0 commit comments

Comments
 (0)