From 9eea66c6f8182ff396141a7be11837b0a0473a36 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 29 Aug 2004 23:33:22 -0400 Subject: [PATCH] added some more python files --- amounts.py | 15 +++++++++++++++ pyamounts.cc | 13 +++++++++++++ python.cc => pyledger.cc | 0 setup_amounts.py | 14 ++++++++++++++ setup_ledger.py | 15 +++++++++++++++ 5 files changed, 57 insertions(+) create mode 100644 amounts.py create mode 100644 pyamounts.cc rename python.cc => pyledger.cc (100%) create mode 100755 setup_amounts.py create mode 100755 setup_ledger.py 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 + +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 similarity index 100% rename from python.cc rename to 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"])])