Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python3 working prototype #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.17)
project(python_cdb C)

set(CMAKE_C_STANDARD 11)

include_directories(src)
include_directories(/usr/include/python3.8/)

add_executable(python_cdb
src/cdb.c
src/cdb.h
src/cdb_hash.c
src/cdb_make.c
src/cdb_make.h
src/cdbmodule.c
src/uint32.h
src/uint32_pack.c
src/uint32_unpack.c src/unicode.c src/unicode.h)
67 changes: 34 additions & 33 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
#! /usr/bin/env python
#! /usr/bin/env python3

SRCDIR = "src"
SRCFILES = map(lambda f: SRCDIR + '/' + f + '.c',
["cdbmodule","cdb","cdb_make","cdb_hash",
"uint32_pack","uint32_unpack"])
from setuptools import setup, Extension

from distutils.core import setup, Extension
SRCDIR = "src"
FILES = ("cdbmodule", "cdb", "cdb_make", "cdb_hash",
"uint32_pack", "uint32_unpack", 'unicode')
SRCFILES = list(map(lambda f: SRCDIR + '/' + f + '.c', FILES))

setup (# Distribution meta-data
name = "python-cdb",
version = "0.35",
description = "Interface to constant database files",
author = "Alan Grow",
author_email = "[email protected]",
license = "GPL",
long_description = \
'''The python-cdb extension module is an adaptation of D. J. Bernstein's
constant database package (see http://cr.yp.to/cdb.html).

cdb files are mappings of keys to values, designed for wickedly
fast lookups and atomic updates. This module mimics the normal
cdb utilities, cdb(get|dump|make), via convenient, high-level Python
objects.''',
ext_modules = [ Extension(
"cdb",
SRCFILES,
include_dirs=[ SRCDIR + '/' ],
extra_compile_args=['-fPIC'],
)
],
url = "https://github.com/acg/python-cdb",
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2',
],
)
setup(
name="python-cdb",
version="0.35",
description="Interface to constant database files",
author="Alan Grow",
author_email="[email protected]",
license="GPL",
long_description='''
The python-cdb extension module is an adaptation of D. J. Bernstein's
constant database package (see http://cr.yp.to/cdb.html).
cdb files are mappings of keys to values, designed for wickedly
fast lookups and atomic updates. This module mimics the normal
cdb utilities, cdb(get|dump|make), via convenient, high-level Python
objects.''',
ext_modules=[
Extension(
"cdb",
SRCFILES,
include_dirs=[SRCDIR + '/' ],
extra_compile_args=['-fPIC'],
)
],
url="https://github.com/acg/python-cdb",
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2',
],
)
2 changes: 1 addition & 1 deletion src/cdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int cdb_read(struct cdb *c,char *buf,unsigned int len,uint32 pos)
static int match(struct cdb *c,char *key,unsigned int len,uint32 pos)
{
char buf[32];
int n;
unsigned int n;

while (len > 0) {
n = sizeof buf;
Expand Down
Loading