summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--amounts.py15
-rw-r--r--pyamounts.cc13
-rw-r--r--pyledger.cc (renamed from python.cc)0
-rwxr-xr-xsetup_amounts.py14
-rwxr-xr-xsetup_ledger.py15
5 files changed, 57 insertions, 0 deletions
diff --git a/amounts.py b/amounts.py
new file mode 100644
index 00000000..f3a58986
--- /dev/null
+++ b/amounts.py
@@ -0,0 +1,15 @@
+from amounts import *
+
+x = Amount ("$123.45")
+print x
+x = x * 2
+print x
+
+y = Amount ("$1000.45")
+print x + y
+
+z = Value ("$1000.45")
+print y + z
+
+z += x
+print z
diff --git a/pyamounts.cc b/pyamounts.cc
new file mode 100644
index 00000000..a8b982cc
--- /dev/null
+++ b/pyamounts.cc
@@ -0,0 +1,13 @@
+#include <boost/python.hpp>
+
+using namespace boost::python;
+
+void export_amount();
+void export_balance();
+void export_value();
+
+BOOST_PYTHON_MODULE(amounts) {
+ export_amount();
+ export_balance();
+ export_value();
+}
diff --git a/python.cc b/pyledger.cc
index d469c2f3..d469c2f3 100644
--- a/python.cc
+++ b/pyledger.cc
diff --git a/setup_amounts.py b/setup_amounts.py
new file mode 100755
index 00000000..663faa2e
--- /dev/null
+++ b/setup_amounts.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+
+from distutils.core import setup, Extension
+
+setup(name = "Amounts",
+ version = "2.0b",
+ description = "Amounts Library",
+ author = "John Wiegley",
+ author_email = "johnw@newartisans.com",
+ url = "http://www.newartisans.com/johnw/",
+ ext_modules = [
+ Extension("amounts", ["pyamounts.cc"],
+ define_macros = [('PYTHON_MODULE', None)],
+ libraries = ["amounts_bpy", "boost_python", "gmp"])])
diff --git a/setup_ledger.py b/setup_ledger.py
new file mode 100755
index 00000000..bb8a78b0
--- /dev/null
+++ b/setup_ledger.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+
+from distutils.core import setup, Extension
+
+setup(name = "Ledger",
+ version = "2.0b",
+ description = "Ledger Accounting Tool",
+ author = "John Wiegley",
+ author_email = "johnw@newartisans.com",
+ url = "http://www.newartisans.com/johnw/",
+ ext_modules = [
+ Extension("ledger", ["pyledger.cc"],
+ define_macros = [('PYTHON_MODULE', None)],
+ libraries = ["amounts_bpy", "ledger_bpy", "boost_python",
+ "pcre", "xmlparse", "xmltok"])])