Improved compatibility with Python 2.4, ready for 0.4 release.

git-svn-id: http://llvm-py.googlecode.com/svn/trunk@48 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
mdevan.foobar 2008-11-21 06:07:14 +00:00
commit c509179c8d
7 changed files with 24 additions and 7 deletions

View file

@ -1,5 +1,5 @@
0.4, in progress:
0.4, 21-Nov-2008:
* Code cleanup, added license headers.
* Added llvm.core.load_library_permanently() (Issue #12).

4
README
View file

@ -25,8 +25,8 @@ Quickstart:
2. Unpack llvm-py, build and install:
$ tar jxvf llvm-py-0.3.tar.bz2
$ cd llvm-py-0.3
$ tar jxvf llvm-py-0.4.tar.bz2
$ cd llvm-py-0.4
# Locate llvm-config, usually under <llvm>/Release/bin
$ sudo python setup.py install --llvm-config=/path/to/llvm-config

View file

@ -40,6 +40,11 @@
/* libc includes */
#include <stdarg.h> /* for malloc(), free() */
/* Compatibility with Python 2.4: Py_ssize_t is not available. */
#ifndef PY_SSIZE_T_MAX
typedef int Py_ssize_t;
#endif
/*===----------------------------------------------------------------------===*/
/* Modules */

View file

@ -747,6 +747,12 @@ def check_is_callable(obj):
return
raise TypeError, "argument is neither a function nor a function pointer"
def _to_int(v):
if v:
return 1
else:
return 0
#===----------------------------------------------------------------------===
# Module
@ -1009,7 +1015,7 @@ class Type(object):
`param_tys'. Set `var_arg' to True (default is False) for a
variadic function."""
check_is_type(return_ty)
var_arg = 1 if var_arg else 0 # convert to int
var_arg = _to_int(var_arg) # ensure int
params = unpack_types(param_tys)
return _make_type(_core.LLVMFunctionType(return_ty.ptr, params,
var_arg), TYPE_FUNCTION)
@ -1636,7 +1642,7 @@ class GlobalVariable(GlobalValue):
return _core.LLVMIsGlobalConstant(self.ptr)
def _set_is_global_constant(self, value):
value = 1 if value else 0
value = _to_int(value)
_core.LLVMSetGlobalConstant(self.ptr, value)
global_constant = property(_get_is_global_constant, _set_is_global_constant)

View file

@ -3,6 +3,8 @@
import sys, os
from distutils.core import setup, Extension
LLVM_PY_VERSION = '0.4'
def _run(cmd):
return os.popen(cmd).read().rstrip()
@ -72,7 +74,7 @@ def call_setup(llvm_config):
setup(
name='llvm-py',
version='0.4',
version=LLVM_PY_VERSION,
description='Python Bindings for LLVM',
author='Mahadevan R',
author_email='mdevan.foobar@gmail.com',

View file

@ -1,7 +1,7 @@
Download
========
The latest release is 0.3, released 8-Sep-2008 (link:#changelog[Changelog]
The latest release is 0.4, released 21-Nov-2008 (link:#changelog[Changelog]
below).
Download it here:
@ -10,6 +10,7 @@ Download it here:
````~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Release,Date,Package,Mirror
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0.4,21-Nov-2008,http://llvm-py.googlecode.com/files/llvm-py-0.4.tar.bz2[llvm-py-0.4.tar.bz2],link:llvm-py-0.4.tar.bz2[llvm-py-0.4.tar.bz2]
0.3,8-Sep-2008,http://llvm-py.googlecode.com/files/llvm-py-0.3.tar.bz2[llvm-py-0.3.tar.bz2],link:llvm-py-0.3.tar.bz2[llvm-py-0.3.tar.bz2]
0.2.1,18-Jun-2008,http://llvm-py.googlecode.com/files/llvm-py-0.2.1.tar.bz2[llvm-py-0.2.1.tar.bz2],link:llvm-py-0.2.1.tar.bz2[llvm-py-0.2.1.tar.bz2]
0.2,15-Jun-2008,http://llvm-py.googlecode.com/files/llvm-py-0.2.tar.bz2[llvm-py-0.2.tar.bz2],link:llvm-py-0.2.tar.bz2[llvm-py-0.2.tar.bz2]

View file

@ -24,6 +24,9 @@ _LLVM 2.4_: Read link:userguide.html#llvm24[this] if you're using LLVM
News
----
21-Nov-2008::
0.4 released. Bug fixes, few additional APIs, code cleanup.
8-Sep-2008::
0.3 released. Passes, intrinsics, bitcode, assembly!