diaomin / py-leveldb

Automatically exported from code.google.com/p/py-leveldb
Other
0 stars 1 forks source link

Extension builds correctly on Windows (Although not with the current distutils script) #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Happened across this extension when I was looking for a python wrapper for 
leveldb, and without noticing the "POSIX" in the package classifier, I 
attempted building py-leveldb against the current release of leveldb-win. 
(http://code.google.com/p/leveldbwin/)

While the setup script didn't work, VC++10 compiled the code just fine using 
the following command:

cl.exe /nologo /LD /EHsc /I[Python Include Folder] /I. /MD /O2 leveldb_ext.cc 
leveldb_object.cc /link leveldb.lib /out:lib\leveldb.pyd /libpath:[Python Libs 
Folder]

I haven't gotten a chance to try out all the API provided by the extension, but 
the example on the front page runs perfectly. If you're interested, I can throw 
together a quick build script for windows.

Original issue reported on code.google.com by cgrunw...@gmail.com on 10 Dec 2011 at 12:08

GoogleCodeExporter commented 9 years ago
That would be cool!

Just put in a copyright notice at the top, e.g.: 

// Copyright (c) Your Name Here.
// See LICENSE for details.

The build instructions need to be updated as well, and a svn:external for 
leveldbwin would be in order.

Original comment by arnim...@gmail.com on 12 Dec 2011 at 11:06

GoogleCodeExporter commented 9 years ago
Hey,

Sorry it took so long to get back to you with this. Got really tied up with 
some projects at work, and ended up completely forgetting about this for a bit.

Anyways, I tried to make minimal changes to the existing setup script, instead 
importing build steps in from a second file if the user is on a Windows PC. It 
will automatically download the leveldbwin source code needed for Window's 
builds, so you shouldn't need anything else. Attached zip should contain the 
updated setup.py, the leveldbwin.py file for building on Windows, and a patch 
of all changes to setup.py.

Just let me know if you have any questions.

Original comment by cgrunw...@gmail.com on 15 Jan 2012 at 2:09

Attachments:

GoogleCodeExporter commented 9 years ago
Oh, and here's a pre-built Windows installer for Python 2.7, in case you wanted 
a release package.

Original comment by cgrunw...@gmail.com on 15 Jan 2012 at 11:26

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Here needed attached patch for leveldb_ext.cc so leveldb.pyd got exported 
module init functions.

PS Used this fresh windows port of leveldb 
https://github.com/chirino/leveldb/blob/master/WINDOWS.md .

Original comment by mos...@gmail.com on 21 Mar 2013 at 3:11

Attachments:

GoogleCodeExporter commented 9 years ago
> Oh, and here's a pre-built Windows installer for Python 2.7,
Note, that there is only win32 version
To build x64 version I first built leveldb itself. Result: leveldb.lib for x64.
Then donloaded py-leveldb sources. Created VS project with 3 source files: 
leveldb_ext.cc
leveldb_ext.h
leveldb_object.cc
Added include and lib dependencies on Python, boost, leveldb.
Applied patch  module-init-functions.patch 
Compiled as dll.

> Here needed attached patch for leveldb_ext.cc so leveldb.pyd got exported 
module init functions.
Patch works fine. Thank you!

Original comment by s.b.maty...@gmail.com on 25 Feb 2015 at 7:46