summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-03-01 15:49:21 +0800
committerTat-Chee Wan (USM)2011-03-01 15:49:21 +0800
commitedf4a348de0ddaf3bd0429d3cbb7dacc3b748954 (patch)
treec6db70e27f2d14c9c2615af5fd9d03752108aede
parenta9c9b62a94e0398e5be0f3eb5f1ef666548617ca (diff)
added pyfantom python module, renamed .cp to .cpp, add setup.py
-rw-r--r--FantomModule/FantomModule.cpp (renamed from FantomModule/FantomModule.cp)2
-rw-r--r--FantomModule/FantomModule.h4
-rw-r--r--FantomModule/FantomModule.xcodeproj/project.pbxproj10
-rw-r--r--FantomModule/pyfantom/__init__.py0
-rw-r--r--FantomModule/setup.py35
5 files changed, 44 insertions, 7 deletions
diff --git a/FantomModule/FantomModule.cp b/FantomModule/FantomModule.cpp
index 60bbe80..ff2c6cd 100644
--- a/FantomModule/FantomModule.cp
+++ b/FantomModule/FantomModule.cpp
@@ -36,7 +36,7 @@ static PyMethodDef FantomMethods[] = {
};
extern "C" PyMODINIT_FUNC
-initspam(void)
+initfantom(void)
{
(void) Py_InitModule("fantom", FantomMethods);
}
diff --git a/FantomModule/FantomModule.h b/FantomModule/FantomModule.h
index 91e7575..4266d04 100644
--- a/FantomModule/FantomModule.h
+++ b/FantomModule/FantomModule.h
@@ -10,7 +10,7 @@
#ifndef FantomModule_
#define FantomModule_
-#include <Python.h>
+#include "Python.h"
#include "fantom/iNXT.h"
#include "fantom/iNXTIterator.h"
#include "fantom/tStatus.h"
@@ -23,7 +23,7 @@
/* The classes below are exported */
#pragma GCC visibility push(default)
-extern "C" PyMODINIT_FUNC initspam(void);
+extern "C" PyMODINIT_FUNC initfantom(void);
extern "C" PyObject *fantom_finddevices(PyObject *py_self, PyObject *py_args);
extern "C" PyObject *fantom_socket(PyObject *py_self, PyObject *py_args);
diff --git a/FantomModule/FantomModule.xcodeproj/project.pbxproj b/FantomModule/FantomModule.xcodeproj/project.pbxproj
index c85a049..f4a5ec8 100644
--- a/FantomModule/FantomModule.xcodeproj/project.pbxproj
+++ b/FantomModule/FantomModule.xcodeproj/project.pbxproj
@@ -19,7 +19,7 @@
43B531FB131C963A0016BF14 /* visatype.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B531FA131C963A0016BF14 /* visatype.h */; };
43B5320A131C975B0016BF14 /* Fantom in Frameworks */ = {isa = PBXBuildFile; fileRef = 43B53209131C975B0016BF14 /* Fantom */; };
50149BDA09E781A5002DEE6A /* FantomModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 50149BD909E781A5002DEE6A /* FantomModule.h */; };
- 5073E0CB09E734E500EC74B6 /* FantomModule.cp in Sources */ = {isa = PBXBuildFile; fileRef = 5073E0C409E734A800EC74B6 /* FantomModule.cp */; };
+ 5073E0CB09E734E500EC74B6 /* FantomModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5073E0C409E734A800EC74B6 /* FantomModule.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -35,8 +35,9 @@
43B531F1131C962E0016BF14 /* tStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tStatus.h; sourceTree = "<group>"; };
43B531FA131C963A0016BF14 /* visatype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = visatype.h; sourceTree = "<group>"; };
43B53209131C975B0016BF14 /* Fantom */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = Fantom; path = /Library/Frameworks/Fantom.framework/Fantom; sourceTree = "<absolute>"; };
+ 43DB2163131CBF18001443AF /* setup.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = setup.py; sourceTree = "<group>"; };
50149BD909E781A5002DEE6A /* FantomModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FantomModule.h; sourceTree = "<group>"; };
- 5073E0C409E734A800EC74B6 /* FantomModule.cp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FantomModule.cp; sourceTree = "<group>"; };
+ 5073E0C409E734A800EC74B6 /* FantomModule.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FantomModule.cpp; sourceTree = "<group>"; };
5073E0C609E734A800EC74B6 /* FantomModuleProj.xcconfig */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xcconfig; path = FantomModuleProj.xcconfig; sourceTree = "<group>"; };
5073E0C709E734A800EC74B6 /* FantomModuleTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xcconfig; path = FantomModuleTarget.xcconfig; sourceTree = "<group>"; };
50B2938909F016FC00694E55 /* FantomModulePriv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FantomModulePriv.h; sourceTree = "<group>"; };
@@ -73,6 +74,7 @@
08FB77ACFE841707C02AAC07 /* Source */,
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */,
034768DDFF38A45A11DB9C8B /* Products */,
+ 43DB2163131CBF18001443AF /* setup.py */,
);
name = FantomModule;
sourceTree = "<group>";
@@ -92,7 +94,7 @@
32BAE0B70371A74B00C91783 /* FantomModule_Prefix.pch */,
50149BD909E781A5002DEE6A /* FantomModule.h */,
50B2938909F016FC00694E55 /* FantomModulePriv.h */,
- 5073E0C409E734A800EC74B6 /* FantomModule.cp */,
+ 5073E0C409E734A800EC74B6 /* FantomModule.cpp */,
);
name = Source;
sourceTree = "<group>";
@@ -191,7 +193,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 5073E0CB09E734E500EC74B6 /* FantomModule.cp in Sources */,
+ 5073E0CB09E734E500EC74B6 /* FantomModule.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/FantomModule/pyfantom/__init__.py b/FantomModule/pyfantom/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/FantomModule/pyfantom/__init__.py
diff --git a/FantomModule/setup.py b/FantomModule/setup.py
new file mode 100644
index 0000000..25dd152
--- /dev/null
+++ b/FantomModule/setup.py
@@ -0,0 +1,35 @@
+from distutils.core import setup, Extension
+import sys
+
+def getextensions():
+ mac_ext = Extension("FantomModule",
+ define_macros=[('PYFANTOM_DEBUG', '0')], # set to '1' to print debug messges
+ include_dirs=['.'],
+ extra_compile_args=['-arch i386'],
+ libraries=["Fantom"],
+ sources=["FantomModule.cpp"]
+ )
+ return [mac_ext]
+
+# install the main library
+setup(name="pyfantom",
+ version="0.1",
+ author="Tat-Chee Wan",
+ author_email="tcwan@cs.usm.my",
+ url="",
+ description="Python Extension to call Fantom Driver",
+ long_description="Python Wrapper for Fantom Driver on Mac OS X.",
+ license="GPL",
+ packages=["pyfantom"],
+ ext_modules=getextensions(),
+ classifiers = [ "Development Status :: 3 - Alpha",
+ "Intended Audience :: Developers",
+ # Need to confirm Fantom / NI-VISA license compatibility
+ # "License :: OSI Approved :: GNU General Public License (GPL)",
+ # "License :: OSI Approved :: GNU General Public License v2",
+ "Programming Language :: C++",
+ "Topic :: Software Development :: Libraries",
+ "Topic :: System :: Networking",
+ "Topic :: Communications",
+ "Operating System :: MacOS :: MacOS X" ]
+ )