Merge lp:~michel-slm/lunatic-python/trunk into lp:lunatic-python

Proposed by Michel Lind
Status: Needs review
Proposed branch: lp:~michel-slm/lunatic-python/trunk
Merge into: lp:lunatic-python
Diff against target: 63 lines (+20/-7)
3 files modified
.bzrignore (+3/-0)
setup.py (+15/-4)
src/luainpython.c (+2/-3)
To merge this branch: bzr merge lp:~michel-slm/lunatic-python/trunk
Reviewer Review Type Date Requested Status
Gustavo Niemeyer Needs Fixing
Review via email: mp+12019@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michel Lind (michel-slm) wrote :

I created two separate changes, and committed them separately for easy merging:
revno 8: make setup.py use pkg-config. I defaulted to using lua.pc, as that is the upstream name,
  but this is overridden by setting the environment variable LUAPCNAME
revno 9: switch fully to the Lua 5.1 API; drop lua_open.

Looks like some other branches have diverged even further; I will look into what they are doing next. Would be nice to merge in some lunit tests.

lp:~michel-slm/lunatic-python/trunk updated
10. By Michel Lind

Merge niemeyer's revision 8: fix number conversion

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Thanks for the changes. The modifications about lua_open look good.

The changes to use pkg-config add boilerplate and in the end
turn setup.py into something that actually doesn't work out of
the box unless an environment variable is set.

I'm happy to integrate the former, but I'd like to keep the
latter simple as it currently is if you don't mind.

Can you please separate it out?

review: Needs Fixing

Unmerged revisions

10. By Michel Lind

Merge niemeyer's revision 8: fix number conversion

9. By Michel Lind

luainpython.c:
  fully switch to Lua 5.1 API; drop deprecated lua_open

8. By Michel Lind

setup.py:
  use pkg-config to discover Lua installation if possible
  fallback to upstream Lua's defaults
.bzrignore:
  ignore build directory and common temporary files

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.bzrignore'
2--- .bzrignore 1970-01-01 00:00:00 +0000
3+++ .bzrignore 2011-03-30 23:06:50 +0000
4@@ -0,0 +1,3 @@
5+./build
6+*#*#
7+*~
8
9=== modified file 'setup.py'
10--- setup.py 2008-05-28 15:48:32 +0000
11+++ setup.py 2011-03-30 23:06:50 +0000
12@@ -1,8 +1,8 @@
13 #!/usr/bin/python
14 from distutils.core import setup, Extension
15 from distutils.sysconfig import get_python_lib, get_python_version
16-import glob
17 import os
18+import commands
19
20 if os.path.isfile("MANIFEST"):
21 os.unlink("MANIFEST")
22@@ -10,10 +10,21 @@
23 # You may have to change these
24 PYLIBS = ["python"+get_python_version(), "pthread", "util"]
25 PYLIBDIR = [get_python_lib(standard_lib=True)+"/config"]
26-#LUALIBS = ["lua", "lualib"]
27-LUALIBS = ["lua5.1"]
28+LUAPCNAME = os.getenv("LUAPCNAME")
29+LUALIBS=["lua"]
30 LUALIBDIR = []
31-LUAINCDIR = glob.glob("/usr/include/lua*")
32+LUAINCDIR=["/usr/include"]
33+if not LUAPCNAME:
34+ PKGBASE='pkg-config lua '
35+else:
36+ PKGBASE='pkg-config %s ' % (LUAPCNAME,)
37+status, output = commands.getstatusoutput(PKGBASE + '--exists')
38+if status == 0:
39+ LUALIBS = [os.popen(PKGBASE + '--libs').readline().split()[0][2:]]
40+ LUALIBDIR = [os.popen(PKGBASE + '--variable=libdir').readline().strip()]
41+ LUAINCDIR = [os.popen(PKGBASE + '--variable=includedir').readline().strip()]
42+else:
43+ print "*** WARN *** lua .pc file not found -- using defaults"
44
45 setup(name="lunatic-python",
46 version = "1.0",
47
48=== modified file 'src/luainpython.c'
49--- src/luainpython.c 2010-03-29 21:13:32 +0000
50+++ src/luainpython.c 2011-03-30 23:06:50 +0000
51@@ -486,10 +486,9 @@
52 m = Py_InitModule("lua", lua_methods);
53
54 if (!L) {
55- L = lua_open();
56- luaopen_base(L);
57+ L = luaL_newstate();
58+ luaL_openlibs(L);
59 luaopen_python(L);
60- luaL_openlibs(L);
61 lua_settop(L, 0);
62 }
63 }

Subscribers

People subscribed via source and target branches

to all changes: