From 9eea66c6f8182ff396141a7be11837b0a0473a36 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 29 Aug 2004 23:33:22 -0400 Subject: added some more python files --- amounts.py | 15 +++++++++++++++ pyamounts.cc | 13 +++++++++++++ pyledger.cc | 34 ++++++++++++++++++++++++++++++++++ python.cc | 34 ---------------------------------- setup_amounts.py | 14 ++++++++++++++ setup_ledger.py | 15 +++++++++++++++ 6 files changed, 91 insertions(+), 34 deletions(-) create mode 100644 amounts.py create mode 100644 pyamounts.cc create mode 100644 pyledger.cc delete mode 100644 python.cc 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/pyledger.cc b/pyledger.cc new file mode 100644 index 00000000..d469c2f3 --- /dev/null +++ b/pyledger.cc @@ -0,0 +1,34 @@ +#include + +using namespace boost::python; + +#include "ledger.h" +#include "acconf.h" + +void export_amount(); +void export_balance(); +void export_value(); +void export_journal(); +void export_parser(); +void export_textual(); +void export_binary(); +void export_qif(); +#ifdef READ_GNUCASH +void export_gnucash(); +#endif +void export_option(); + +BOOST_PYTHON_MODULE(ledger) { + export_amount(); + export_balance(); + export_value(); + export_journal(); + export_parser(); + export_textual(); + export_binary(); + export_qif(); +#ifdef READ_GNUCASH + export_gnucash(); +#endif + export_option(); +} diff --git a/python.cc b/python.cc deleted file mode 100644 index d469c2f3..00000000 --- a/python.cc +++ /dev/null @@ -1,34 +0,0 @@ -#include - -using namespace boost::python; - -#include "ledger.h" -#include "acconf.h" - -void export_amount(); -void export_balance(); -void export_value(); -void export_journal(); -void export_parser(); -void export_textual(); -void export_binary(); -void export_qif(); -#ifdef READ_GNUCASH -void export_gnucash(); -#endif -void export_option(); - -BOOST_PYTHON_MODULE(ledger) { - export_amount(); - export_balance(); - export_value(); - export_journal(); - export_parser(); - export_textual(); - export_binary(); - export_qif(); -#ifdef READ_GNUCASH - export_gnucash(); -#endif - export_option(); -} 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"])]) -- cgit v1.2.3