[ENet-discuss] setup.py for python wrappers.
Ling Lo
enet-discuss@lists.puremagic.com
Sat, 8 Feb 2003 23:24:09 -0000
This is a multi-part message in MIME format.
------=_NextPart_000_0105_01C2CFC9.2F2B7AF0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Rene Dudfield wrote:
Hey,
> attached is a setup.py for the python wrappers.
>
> I've tested it on debian unstable linux, and the tests
> run and do stuff.
>
> Not tested on windows/mac/other_nix etc.
>
> In the setup.py file is a link to the distutils
> documentation. It should be pretty easy to modify to
> get working in windows etc.
I twiddled a bit further and came up with this. Can't test it on any unix
box since the only one I have access to does not have a recent nor full
Python dev environment. It now sits in /pyenet directory and compiles enet
as well. I realise this duplicates the makefile but I'm thinking this might
make it easier for those who want to install this from source using one
entry point.
--
| Ling Lo
_O_O_
------=_NextPart_000_0105_01C2CFC9.2F2B7AF0
Content-Type: text/plain;
name="setup.py"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="setup.py"
#!/usr/bin/env python=0A=
=0A=
# see http://www.python.org/doc/current/dist/setup-script.html =0A=
# for distutil options.=0A=
#=0A=
# Original version by Rene Dudfield <illumen@yahoo.com>=0A=
import sys, os, os.path=0A=
from distutils.core import setup, Extension=0A=
=0A=
source_dirs =3D ['..', '.']=0A=
define_macros =3D [('HAS_GETHOSTBYNAME_R', None),=0A=
('HAS_GETHOSTBYADDR_R', None),=0A=
('HAS_POLL', None),=0A=
('HAS_FCNTL', None),=0A=
('HAS_MSGHDR_FLAGS', None) ]=0A=
=0A=
source_files =3D []=0A=
libraries =3D []=0A=
=0A=
# Build a list of all the source files=0A=
for dir in source_dirs:=0A=
for file in os.listdir(dir):=0A=
if '.c' =3D=3D os.path.splitext(file)[1]:=0A=
source_files.append(dir + '/' + file)=0A=
=0A=
# Additional Windows dependencies=0A=
if sys.platform =3D=3D 'win32':=0A=
define_macros.append(('WIN32', None))=0A=
libraries.append('ws2_32')=0A=
=0A=
# Go force and multiply=0A=
setup(name=3D"enet", version=3D"0.1",=0A=
ext_modules=3D[Extension("enet", =0A=
source_files,=0A=
include_dirs=3D["../include"],=0A=
define_macros=3Ddefine_macros,=0A=
libraries=3Dlibraries,=0A=
library_dirs=3D[]=0A=
)=0A=
]=0A=
)=0A=
=0A=
------=_NextPart_000_0105_01C2CFC9.2F2B7AF0--