diff options
author | Justin Lecher <jlec@gentoo.org> | 2010-12-23 08:26:55 +0000 |
---|---|---|
committer | Justin Lecher <jlec@gentoo.org> | 2010-12-23 08:26:55 +0000 |
commit | ae444f688678dfe792727501798b8bba9901bc7b (patch) | |
tree | e2734f3af17c5748046e2d8e950b67a12abc85ea /sci-mathematics | |
parent | ppc64 stable wrt #341703 (diff) | |
download | historical-ae444f688678dfe792727501798b8bba9901bc7b.tar.gz historical-ae444f688678dfe792727501798b8bba9901bc7b.tar.bz2 historical-ae444f688678dfe792727501798b8bba9901bc7b.zip |
Verify and potentially improve Python-related code, #316231; removed old patches
Package-Manager: portage-2.2.0_alpha6/cvs/Linux x86_64
Diffstat (limited to 'sci-mathematics')
-rw-r--r-- | sci-mathematics/fann/ChangeLog | 7 | ||||
-rw-r--r-- | sci-mathematics/fann/Manifest | 18 | ||||
-rw-r--r-- | sci-mathematics/fann/fann-2.0.0.ebuild | 83 | ||||
-rw-r--r-- | sci-mathematics/fann/fann-2.1.0_beta.ebuild | 51 | ||||
-rw-r--r-- | sci-mathematics/fann/files/fann-1.2.0-r1.patch | 417 | ||||
-rw-r--r-- | sci-mathematics/fann/files/fann-1.2.0-setup.py | 46 |
6 files changed, 99 insertions, 523 deletions
diff --git a/sci-mathematics/fann/ChangeLog b/sci-mathematics/fann/ChangeLog index f7d9c74cc1a3..aa6b725bdc4c 100644 --- a/sci-mathematics/fann/ChangeLog +++ b/sci-mathematics/fann/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for sci-mathematics/fann # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/fann/ChangeLog,v 1.14 2010/06/04 15:32:47 arfrever Exp $ +# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/fann/ChangeLog,v 1.15 2010/12/23 08:26:55 jlec Exp $ + + 23 Dec 2010; Justin Lecher <jlec@gentoo.org> -files/fann-1.2.0-r1.patch, + -files/fann-1.2.0-setup.py, fann-2.0.0.ebuild, fann-2.1.0_beta.ebuild: + Verify and potentially improve Python-related code, #316231; removed old + patches 04 Jun 2010; Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> fann-2.1.0_beta.ebuild: diff --git a/sci-mathematics/fann/Manifest b/sci-mathematics/fann/Manifest index 5c886e8cbf8e..535d9c93e851 100644 --- a/sci-mathematics/fann/Manifest +++ b/sci-mathematics/fann/Manifest @@ -1,5 +1,6 @@ -AUX fann-1.2.0-r1.patch 14130 RMD160 b6cf23f60464efb330af374cbce21825f79f051c SHA1 bfbee4b483b22db3487c9751c4bdf0a48aa86aef SHA256 e3c902ae4d1bf6c1f007319406742285f762def454be590c2e8774cfc1263892 -AUX fann-1.2.0-setup.py 1503 RMD160 5577f9ca2845e09454ced87df38eabe8e164bfc0 SHA1 e70764a15c23b8b958b309b029586ba9ea129a87 SHA256 2b77107528c369fbf557b5c502bea17fdea2144d9a8caa906a1c531bc348adba +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + AUX fann-2.0.0-benchmark.patch 1986 RMD160 9660044ab4fadc476cda8653ad171ef7b0d5e1e5 SHA1 43645f9e1a198040d7c63d2da7755696087f07bc SHA256 ba4dd808fc66dd7fadb61e82ff12fdb6841c56e70c3d17a6a5e8d316e4d79b66 AUX fann-2.0.0-shared-libs-gentoo.patch 1193 RMD160 b7e70b62187fe81363406fad1cabffbd9c98349c SHA1 c2d27d013e11d7bf0098dccf6ad619a32d25a1c8 SHA256 788faf6fde0ee954581b95e2630b265aeb3e88c3bb2fd696bc98e470b87b30f3 AUX fann-2.1.0_beta-asneeded.patch 280 RMD160 495614dcab634ada103a1be9755f5e54d32ef2b8 SHA1 a9dc32d477a30a2682fdf301922da3dc73778dc6 SHA256 a9ff761ccaf54136795f4491945c486a23560db15f8839991ce8c2a8cee73187 @@ -8,7 +9,14 @@ AUX fann-2.1.0_beta-examples.patch 923 RMD160 7379369370db10635234f7245f4636969e AUX fann-2.1.0_beta-python.patch 750 RMD160 1609d02da5096c2fc3404f2747f55261faba58bd SHA1 9cf261f3733be27a49e8bcebf0879347fb7b1d6a SHA256 94490da5c5b6216c97e987965b92347e3d5125ea32a9aaa62cd8b584036f9a01 DIST fann-2.0.0.tar.bz2 2310853 RMD160 9d7268eaf06ab177eafb72359a1cf73a70e5a886 SHA1 af4d4efe2362e68929bee73cde85bca10c48df43 SHA256 762a1313a9b935300cb66ebf052d469d04823ca721fe6dd2a49c01e13e8ab30a DIST fann-2.1.0beta.zip 4033198 RMD160 f0d5366547a1f3998246b9ffec9c9a65ec70fa9e SHA1 ee86afbb9787cd41a42e07db2a9bc10699b555f6 SHA256 c24171b5b9c87946bd2f50045cc8dbd0121629fe426615501db14e6043e4a141 -EBUILD fann-2.0.0.ebuild 1838 RMD160 2dd97d2396b1937461060a7b832ca7cfb536b6a5 SHA1 30252e4366a99e7b57950a98681e0d222b8d7b01 SHA256 7cdf98b489d3ffda3e2c19c0b98cf64191640c2b281b8f72bb2b11e0c4000577 -EBUILD fann-2.1.0_beta.ebuild 1929 RMD160 4c672f9d35b9bb3c1928bca84c1587ffc4e0d6ea SHA1 e65db98ad57ced0a007e1406b35c9f1664a316a9 SHA256 101301ba463c67161ebde6bc77e51e1d6aaec956660b9450a4b630a489536a95 -MISC ChangeLog 2633 RMD160 89f313d8d464bd0f5f04601c2732cfcebc9ee3e6 SHA1 0cdc45bbb33af29a93026a78d2597859ca449c00 SHA256 fd560fe83043acfbe103c02c239ccf1a2146cdc8411dd1f5cef8e744f63d9e5e +EBUILD fann-2.0.0.ebuild 1855 RMD160 e266c54e5e9d1c59349bd7dcdb372251bc3fabe5 SHA1 360f872831c5a3df84807ab7c63850a71161dadb SHA256 8daee06d19d14f7c39a35d090b5e797baa7e9f0ff88c764a7315c792f77a425f +EBUILD fann-2.1.0_beta.ebuild 2262 RMD160 a6bfd0bcfbeb33b6efaabf2a1ec006fd4ef07624 SHA1 35f7f965ce3be59cdebdb0c8c8308d433da07ed2 SHA256 25e542c1d638094c60f368c7671811793f899ea4f2bc0761ff8fc0906987bbdf +MISC ChangeLog 2863 RMD160 5f5344cb06a94fafc7178c301611e189feb579f6 SHA1 10be359f10cc563337bad9b785f33fc0ab24165a SHA256 69e803881cd2080c94ff0b74445f14fada1599824cd9b3e9d7743f0dbe149f4b MISC metadata.xml 658 RMD160 25e209eb45899500179b5f893cc72ca41ab2370a SHA1 0c05318426869d997f382e37c9a9a5371123b052 SHA256 003060bd03fae3d61eeffbe23a4b181b905761a9e21bb1482fdec962e099641b +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.16 (GNU/Linux) + +iEYEARECAAYFAk0TB9oACgkQgAnW8HDreRaYzwCdH6DnK/YoFHOK6RhQzHJBdXnA +vPMAoMo2h9bYa3HZImldRypkqLnRPupP +=3dLG +-----END PGP SIGNATURE----- diff --git a/sci-mathematics/fann/fann-2.0.0.ebuild b/sci-mathematics/fann/fann-2.0.0.ebuild index beaa6df68635..61a71e4ed63c 100644 --- a/sci-mathematics/fann/fann-2.0.0.ebuild +++ b/sci-mathematics/fann/fann-2.0.0.ebuild @@ -1,68 +1,77 @@ -# Copyright 1999-2008 Gentoo Foundation +# Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/fann/fann-2.0.0.ebuild,v 1.6 2008/05/12 13:10:17 markusle Exp $ +# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/fann/fann-2.0.0.ebuild,v 1.7 2010/12/23 08:26:55 jlec Exp $ -inherit eutils +EAPI=2 -DESCRIPTION="Fast Artificial Neural Network Library implements multilayer artificial neural networks in C" +PYTHON_DEPEND="python? 2" +SUPPORT_PYTHON_ABIS="1" +RESTRICT_PYTHON_ABIS="3.*" + +inherit eutils python + +MY_P=${P/_/} + +DESCRIPTION="Fast Artificial Neural Network Library" HOMEPAGE="http://leenissen.dk/fann/" -SRC_URI="mirror://sourceforge/fann/${P}.tar.bz2" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2" LICENSE="LGPL-2.1" SLOT="0" KEYWORDS="~amd64 ~ppc ~x86" IUSE="doc python" -RDEPEND="python? ( dev-lang/python )" -DEPEND="${RDEPEND} - python? ( dev-lang/swig )" +RDEPEND="" +DEPEND=" + ${RDEPEND} + python? ( dev-lang/swig )" -src_unpack() { - unpack ${A} - cd "${S}" - epatch "${FILESDIR}"/${P}-shared-libs-gentoo.patch - epatch "${FILESDIR}"/${P}-benchmark.patch +src_prepare() { + epatch \ + "${FILESDIR}"/${P}-shared-libs-gentoo.patch \ + "${FILESDIR}"/${P}-benchmark.patch + use python && python_copy_sources python } src_compile() { - econf ${myconf} || die "configure failed" emake || die "failed to build src" - if use python; then - cd "${S}"/python || \ - die "failed to step into python subdirectory" - emake || die "failed to build python wrappers" - cd "${S}" - fi + compilation() { + emake PYTHON_VERSION="$(python_get_version)" || die "emake python failed" + } + use python && python_execute_function -s --source-dir python compilation } src_install() { - make install DESTDIR="${D}" || die "install failed" - dodoc AUTHORS ChangeLog NEWS README TODO + emake install DESTDIR="${D}" || die "install failed" + dodoc AUTHORS ChangeLog NEWS README TODO || die if use doc; then dodoc doc/*.txt || \ die "failed to install docs" - insinto /usr/share/doc/${P} + insinto /usr/share/doc/${PF} doins doc/fann_en.pdf || \ die "failed to install reference manual" - insinto /usr/share/${PN}/benchmarks - doins -r benchmarks/* || \ + insinto /usr/share/${PN} + doins -r benchmarks || \ die "failed to install benchmarks" - insinto /usr/share/${PN}/examples - doins examples/* || \ + doins -r examples || \ die "failed to install examples" fi - if use python; then - cd "${S}"/python || \ - die "Faild to step into python subdirectory" - make install ROOT="${D}" || \ - die "failed to install python wrappers" + installation() { + emake install ROOT="${D}" || die "failed to install python wrappers" if use doc; then - local python_doc_dir="/usr/share/${PN}/examples/python" - insinto ${python_doc_dir} - doins examples/* || \ - die "failed to install python examples" + insinto /usr/share/doc/${PF}/examples/python + doins -r examples || die "failed to install python examples" fi - fi + } + use python && python_execute_function -s --source-dir python installation +} + +pkg_postinst() { + python_mod_optimize py${PN} +} + +pkg_postrm() { + python_mod_cleanup py${PN} } diff --git a/sci-mathematics/fann/fann-2.1.0_beta.ebuild b/sci-mathematics/fann/fann-2.1.0_beta.ebuild index 1534700a45c8..61b5d5b79d01 100644 --- a/sci-mathematics/fann/fann-2.1.0_beta.ebuild +++ b/sci-mathematics/fann/fann-2.1.0_beta.ebuild @@ -1,11 +1,17 @@ # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/fann/fann-2.1.0_beta.ebuild,v 1.4 2010/06/04 15:32:47 arfrever Exp $ +# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/fann/fann-2.1.0_beta.ebuild,v 1.5 2010/12/23 08:26:55 jlec Exp $ EAPI=2 + +PYTHON_DEPEND="python? 2" +SUPPORT_PYTHON_ABIS="1" +RESTRICT_PYTHON_ABIS="3.*" + inherit eutils python autotools MY_P=${P/_/} + DESCRIPTION="Fast Artificial Neural Network Library" HOMEPAGE="http://leenissen.dk/fann/" SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip" @@ -15,27 +21,30 @@ SLOT="0" KEYWORDS="~amd64 ~ppc ~x86" IUSE="doc python" -RDEPEND="python? ( virtual/python )" -DEPEND="${RDEPEND} +RDEPEND="" +DEPEND=" + ${RDEPEND} python? ( dev-lang/swig ) app-arch/unzip" S="${WORKDIR}/${P/_beta/}" src_prepare() { - epatch "${FILESDIR}"/${P}-python.patch - epatch "${FILESDIR}"/${P}-benchmark.patch - epatch "${FILESDIR}"/${P}-examples.patch - epatch "${FILESDIR}"/${P}-asneeded.patch + epatch \ + "${FILESDIR}"/${P}-python.patch \ + "${FILESDIR}"/${P}-benchmark.patch \ + "${FILESDIR}"/${P}-examples.patch \ + "${FILESDIR}"/${P}-asneeded.patch eautoreconf + use python && python_copy_sources python } src_compile() { emake || die "emake failed" - if use python; then - cd "${S}"/python + compilation() { emake PYTHON_VERSION="$(python_get_version)" || die "emake python failed" - fi + } + use python && python_execute_function -s --source-dir python compilation } src_test() { @@ -44,15 +53,15 @@ src_test() { || die "emake examples failed" LD_LIBRARY_PATH="../src/.libs" emake runtest || die "tests failed" emake clean - if use python; then - cd "${S}"/python + testing() { emake test || die "failed tests for python wrappers" - fi + } + use python && python_execute_function -s --source-dir python testing } src_install() { emake install DESTDIR="${D}" || die "emake install failed" - dodoc AUTHORS ChangeLog NEWS README TODO + dodoc AUTHORS ChangeLog NEWS README TODO || die if use doc; then dodoc doc/*.txt @@ -62,12 +71,20 @@ src_install() { doins -r benchmarks || die "failed to install benchmarks" fi - if use python; then - cd "${S}"/python + installation() { emake install ROOT="${D}" || die "failed to install python wrappers" if use doc; then insinto /usr/share/doc/${PF}/examples/python doins -r examples || die "failed to install python examples" fi - fi + } + use python && python_execute_function -s --source-dir python installation +} + +pkg_postinst() { + python_mod_optimize py${PN} +} + +pkg_postrm() { + python_mod_cleanup py${PN} } diff --git a/sci-mathematics/fann/files/fann-1.2.0-r1.patch b/sci-mathematics/fann/files/fann-1.2.0-r1.patch deleted file mode 100644 index 12aae86dad7e..000000000000 --- a/sci-mathematics/fann/files/fann-1.2.0-r1.patch +++ /dev/null @@ -1,417 +0,0 @@ -diff -N -u -r fann-1.2.0.orig/python/examples/mushroom.py fann-1.2.0.my/python/examples/mushroom.py ---- fann-1.2.0.orig/python/examples/mushroom.py 2004-07-24 01:36:04.000000000 +0200 -+++ fann-1.2.0.my/python/examples/mushroom.py 2005-01-03 20:48:21.000000000 +0100 -@@ -20,9 +20,9 @@ - - # start training the network - print "Training network" --ann.set_activation_function_hidden(fann.FANN_SIGMOID_SYMMETRIC_STEPWISE) --ann.set_activation_function_output(fann.FANN_SIGMOID_STEPWISE) --ann.set_training_algorithm(fann.FANN_TRAIN_INCREMENTAL) -+ann.set_activation_function_hidden(fann.SIGMOID_SYMMETRIC_STEPWISE) -+ann.set_activation_function_output(fann.SIGMOID_STEPWISE) -+ann.set_training_algorithm(fann.TRAIN_INCREMENTAL) - - ann.train_on_data(train_data, max_iterations, iterations_between_reports, desired_error) - -@@ -40,9 +40,3 @@ - print "Saving network" - ann.save("mushroom_float.net") - --# blow it all up --print "Cleaning up." --ann.destroy() --test_data.destroy() --train_data.destroy() -- -diff -N -u -r fann-1.2.0.orig/python/examples/simple_train.py fann-1.2.0.my/python/examples/simple_train.py ---- fann-1.2.0.orig/python/examples/simple_train.py 2004-07-24 01:35:58.000000000 +0200 -+++ fann-1.2.0.my/python/examples/simple_train.py 2005-01-03 20:48:01.000000000 +0100 -@@ -12,9 +12,9 @@ - iterations_between_reports = 1000 - - ann = fann.create(connection_rate, learning_rate, (num_input, num_neurons_hidden, num_output)) -+ann.set_activation_function_output(fann.SIGMOID_SYMMETRIC_STEPWISE) - - ann.train_on_file("datasets/xor.data", max_iterations, iterations_between_reports, desired_error) - - ann.save("xor_float.net") - --ann.destroy() -diff -N -u -r fann-1.2.0.orig/python/fann_helper.c fann-1.2.0.my/python/fann_helper.c ---- fann-1.2.0.orig/python/fann_helper.c 2004-07-26 09:52:30.000000000 +0200 -+++ fann-1.2.0.my/python/fann_helper.c 2005-01-03 22:13:09.000000000 +0100 -@@ -68,3 +68,8 @@ - return get_row_from_double_array(t->output, row, t->num_output);
- }
-
-+
-+int fann_is_NULL(struct fann *ann)
-+{
-+ return ann == NULL ? 1 : 0;
-+}
-diff -N -u -r fann-1.2.0.orig/python/fann.py fann-1.2.0.my/python/fann.py ---- fann-1.2.0.orig/python/fann.py 2004-07-26 09:46:04.000000000 +0200 -+++ fann-1.2.0.my/python/fann.py 2005-01-03 22:32:49.000000000 +0100 -@@ -21,30 +21,23 @@ - - import libfann - --# Activation function --FANN_LINEAR = 0 --FANN_THRESHOLD = 1 --FANN_THRESHOLD_SYMMETRIC = 2 --FANN_SIGMOID = 3 --FANN_SIGMOID_STEPWISE = 4 # default --FANN_SIGMOID_SYMMETRIC = 5 --FANN_SIGMOID_SYMMETRIC_STEPWISE = 6 --FANN_GAUSSIAN = 7 --FANN_GAUSSIAN_STEPWISE = 8 --FANN_ELLIOT = 9 # not implemented yet --FANN_ELLIOT_SYMMETRIC = 10 # not implemented yet -- --# Training algorithm --FANN_TRAIN_INCREMENTAL = 0 --FANN_TRAIN_BATCH = 1 --FANN_TRAIN_RPROP = 2 --FANN_TRAIN_QUICKPROP = 3 -+# import all FANN_ constants without FANN_ prefix -+for name, value in libfann.__dict__.iteritems(): -+ if name.startswith('FANN_') and not name.endswith('_NAMES'): -+ globals()[name[5:]] = value -+del name, value - - class fann_class: - - def __init__(self, ann): -+ """ -+ Never call this directly. -+ """ - self.__ann = ann -- -+ -+ def __del__(self): -+ libfann.fann_destroy(self.__ann) -+ - def get_native_object(self): - return self.__train_data - -@@ -54,13 +47,6 @@ - """ - return libfann.fann_run(self.__ann, input) - -- def destroy(self): -- """ -- Destructs the entire network. -- Be sure to call this function after finished using the network. -- """ -- libfann.fann_destroy(self.__ann) -- - def randomize_weights(self, min_weight, max_weight): - """ - Randomize weights (from the beginning the weights are random between -0.1 and 0.1) -@@ -198,31 +184,31 @@ - """ - libfann.fann_set_activation_function_output(self.__ann, activation_function) - -- def get_activation_hidden_steepness(self): -+ def get_activation_steepness_hidden(self): - """ - Get the steepness parameter for the sigmoid function used in the hidden layers. - """ -- return libfann.get_activation_hidden_steepness(self.__ann) -+ return libfann.get_activation_steepness_hidden(self.__ann) - -- def set_activation_hidden_steepness(self, steepness): -+ def set_activation_steepness_hidden(self, steepness): - """ - Set the steepness of the sigmoid function used in the hidden layers. - Only usefull if sigmoid function is used in the hidden layers (default 0.5). - """ -- libfann.fann_set_activation_hidden_steepness(self.__ann, steepness) -+ libfann.fann_set_activation_steepness_hidden(self.__ann, steepness) - -- def get_activation_output_steepness(self): -+ def get_activation_steepness_output(self): - """ - Get the steepness parameter for the sigmoid function used in the output layer. - """ -- return libfann.fann_get_activation_output_steepness(self.__ann) -+ return libfann.fann_get_activation_steepness_output(self.__ann) - -- def set_activation_output_steepness(self, steepness): -+ def set_activation_steepness_output(self, steepness): - """ - Set the steepness of the sigmoid function used in the output layer. - Only usefull if sigmoid function is used in the output layer (default 0.5). - """ -- libfann.fann_set_activation_output_steepness(self.__ann, steepness) -+ libfann.fann_set_activation_steepness_output(self.__ann, steepness) - - def train_on_data(self, data, max_epochs, epochs_between_reports, desired_error): - """ -@@ -269,7 +255,12 @@ - class train_class: - - def __init__(self, train_data): -+ """ -+ Never call this directly. -+ """ - self.__train_data = train_data -+ def __del__(self): -+ libfann.fann_destroy_train(self.__train_data) - - def get_native_object(self): - return self.__train_data -@@ -289,13 +280,6 @@ - def get_output(self, index): - return libfann.get_train_data_output(self.__train_data, index); - -- def destroy(self): -- """ -- Destructs the training data -- Be sure to call this function after finished using the training data. -- """ -- libfann.fann_destroy_train(self.__train_data) -- - def shuffle(self): - """ - Shuffles training data, randomizing the order -@@ -317,12 +301,10 @@ - - def merge(self, other): - """ -- Merges training data into a single struct -+ Merges training data into a new struct - """ - outcome = libfann.fann_merge_train_data(self.__train_data, other.get_native_object()) -- self.destroy() -- self.__train_data = outcome -- return self -+ return train_class(outcome) - - def duplicate(self): - """ -@@ -345,6 +327,8 @@ - When running the network, the bias nodes always emits 1 - """ - ann = libfann.fann_create_array(connection_rate, learning_rate, len(layers), layers) -+ if libfann.fann_is_NULL(ann): -+ return None # probably won't happen - return fann_class(ann) - - def create_from_file(filename): -@@ -352,6 +336,8 @@ - Constructs a backpropagation neural network from a configuration file. - """ - ann = libfann.fann_create_from_file(filename) -+ if libfann.fann_is_NULL(ann): -+ raise IOError, "Could not load ann from file '%s'" + filename - return fann_class(ann) - - def read_train_from_file(filename): -diff -N -u -r fann-1.2.0.orig/python/libfann.i fann-1.2.0.my/python/libfann.i ---- fann-1.2.0.orig/python/libfann.i 2004-07-20 00:21:20.000000000 +0200 -+++ fann-1.2.0.my/python/libfann.i 2005-01-03 22:58:56.000000000 +0100 -@@ -7,15 +7,16 @@ - #include "../src/include/fann.h"
- %}
-
--%typemap(in) fann_type[ANY] {
-+%define CHECKED_FLOAT_ARRAY(typemap_name, expected_length)
-+%typemap(in) typemap_name {
- int i;
- if (!PySequence_Check($input)) {
- PyErr_SetString(PyExc_ValueError,"Expected a sequence");
-- return NULL;
-+ SWIG_fail;
- }
-- if (PySequence_Length($input) == 0) {
-- PyErr_SetString(PyExc_ValueError,"Size mismatch. Expected some elements");
-- return NULL;
-+ if (PySequence_Length($input) != expected_length) {
-+ PyErr_SetString(PyExc_ValueError,"Sequence has wrong length");
-+ SWIG_fail;
- }
- $1 = (float *) malloc(PySequence_Length($input)*sizeof(float));
- for (i = 0; i < PySequence_Length($input); i++) {
-@@ -24,20 +25,29 @@ - $1[i] = (float) PyFloat_AsDouble(o);
- } else {
- PyErr_SetString(PyExc_ValueError,"Sequence elements must be numbers");
-- return NULL;
-+ Py_DECREF(o);
-+ SWIG_fail;
- }
-+ Py_DECREF(o);
- }
- }
-+%typemap(freearg) typemap_name {
-+ if ($1) free($1);
-+}
-+%enddef
-+
-+CHECKED_FLOAT_ARRAY(fann_type *input, arg1->num_input)
-+CHECKED_FLOAT_ARRAY(fann_type *desired_output, arg1->num_output)
-
- %typemap(in) int[ANY] {
- int i;
- if (!PySequence_Check($input)) {
- PyErr_SetString(PyExc_ValueError,"Expected a sequence");
-- return NULL;
-+ SWIG_fail;
- }
- if (PySequence_Length($input) == 0) {
- PyErr_SetString(PyExc_ValueError,"Size mismatch. Expected some elements");
-- return NULL;
-+ SWIG_fail;
- }
- $1 = (unsigned int *) malloc(PySequence_Length($input)*sizeof(unsigned int));
- for (i = 0; i < PySequence_Length($input); i++) {
-@@ -46,37 +56,41 @@ - $1[i] = (int) PyInt_AsLong(o);
- } else {
- PyErr_SetString(PyExc_ValueError,"Sequence elements must be numbers");
-- return NULL;
-+ Py_DECREF(o);
-+ SWIG_fail;
- }
-+ Py_DECREF(o);
- }
- }
--
--%typemap(freearg) fann_type* {
-+%typemap(freearg) int[ANY] {
- if ($1) free($1);
- }
-+%apply int[ANY] {int *, unsigned int*};
-+
-+typedef double fann_type;
-
- %typemap(out) PyObject* {
- $result = $1;
- }
-
--%apply fann_type[ANY] {fann_type *};
--%apply int[ANY] {int *, unsigned int*};
-+// create_array is used instead
-+%ignore fann_create;
-+%ignore fann_create_shortcut;
-
--#define FANN_INCLUDE
--%varargs(10,int n = 0) fann_create;
- %rename(fann_run_old) fann_run;
- %rename(fann_run) fann_run2;
-
- %rename(fann_test_old) fann_test;
- %rename(fann_test) fann_test2;
-
-+#define FANN_INCLUDE
- %include "../src/include/fann.h"
- %include "../src/include/fann_data.h"
-+%include "../src/include/fann_activation.h"
-
- // Helper functions
- PyObject* fann_run2(struct fann *ann, fann_type *input);
- PyObject* fann_test2(struct fann *ann, fann_type *input, fann_type *desired_output);
- PyObject* get_train_data_input(struct fann_train_data *ann, int row);
- PyObject* get_train_data_output(struct fann_train_data *ann, int row);
--
--
-+int fann_is_NULL(struct fann *ann);
-diff -N -u -r fann-1.2.0.orig/python/makefile.gnu fann-1.2.0.my/python/makefile.gnu ---- fann-1.2.0.orig/python/makefile.gnu 2004-10-09 13:56:57.000000000 +0200 -+++ fann-1.2.0.my/python/makefile.gnu 2005-01-02 16:52:23.000000000 +0100 -@@ -1,5 +1,7 @@ - # This makefile was written to compile a distribution of pyfann for - # GNU platforms (cygwin included.) -+# -+# This is NOT needed for Linux/Unix, use setup_unix.py instead. - - TARGETS = _libfann.dll - -diff -N -u -r fann-1.2.0.orig/python/README fann-1.2.0.my/python/README ---- fann-1.2.0.orig/python/README 2004-08-06 10:54:13.000000000 +0200 -+++ fann-1.2.0.my/python/README 2005-01-02 17:00:28.000000000 +0100 -@@ -1,6 +1,9 @@ - This python binding is provided by Vincenzo Di Massa <hawk.it@tiscalinet.it> - and Gil Megidish <gil@megidish.net> - -+Instructions for Windows: -+^^^^^^^^^^^^^^^^^^^^^^^^^ -+ - MAKE - Make sure to make the fann library first. You are required to have - swig and python development files installed. After you compiled the -@@ -24,3 +27,17 @@ - - USAGE - Just import fann. -+ -+Instructions for Unix/Linux: -+^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -+ -+First build and install the fann library. Then run: -+ -+./setup_unix.py build -+./setup_unix.py install -+ -+Install alone will work too, if you run it twice (a small bug). -+The examples/ (not installed) should work now after you copy the datasets: -+ -+mkdir examples/datasets -+cp ../examples/xor.data ../benchmarks/datasets/mushroom.* examples/datasets/ -diff -N -u -r fann-1.2.0.orig/python/setup.py fann-1.2.0.my/python/setup.py ---- fann-1.2.0.orig/python/setup.py 2004-07-26 09:56:59.000000000 +0200 -+++ fann-1.2.0.my/python/setup.py 2005-01-02 16:49:45.000000000 +0100 -@@ -22,7 +22,7 @@ - """
- override default distutils install_data, so we can copy
- files directly, without splitting into modules, scripts,
-- packages, and extensions."
-+ packages, and extensions.
- """
- def run(self):
- # need to change self.install_dir to the actual library dir
-diff -N -u -r fann-1.2.0.orig/python/setup_unix.py fann-1.2.0.my/python/setup_unix.py ---- fann-1.2.0.orig/python/setup_unix.py 1970-01-01 01:00:00.000000000 +0100 -+++ fann-1.2.0.my/python/setup_unix.py 2005-01-02 16:27:17.000000000 +0100 -@@ -0,0 +1,38 @@ -+#!/usr/bin/env python -+from distutils.core import setup, Extension -+#from glob import glob -+ -+VERSION='1.2.0' -+ -+LONG_DESCRIPTION="""\ -+Fast Artificial Neural Network Library implements multilayer -+artificial neural networks with support for both fully connected -+and sparsely connected networks. It includes a framework for easy -+handling of training data sets. It is easy to use, versatile, well -+documented, and fast. -+""" -+ -+module1 = Extension( -+ '_libfann', -+ sources = ['libfann.i', 'fann_helper.c'], -+ libraries = ['fann'], -+ #extra_objects = glob('../src/fann*.o'), -+ ) -+ -+setup( -+ name='pyfann', -+ version=VERSION, -+ description='Fast Artificial Neural Network Library (fann)', -+ long_description=LONG_DESCRIPTION, -+ author='Steffen Nissen', -+ author_email='lukesky@diku.dk', -+ maintainer='Gil Megidish', -+ maintainer_email='gil@megidish.net', -+ url='http://sourceforge.net/projects/fann/', -+ license='GNU LESSER GENERAL PUBLIC LICENSE (LGPL)', -+ platforms='UNIX', -+ -+ ext_modules = [module1], -+ py_modules = ['libfann', 'fann'] -+ ) -+ diff --git a/sci-mathematics/fann/files/fann-1.2.0-setup.py b/sci-mathematics/fann/files/fann-1.2.0-setup.py deleted file mode 100644 index 82e8e10f46ca..000000000000 --- a/sci-mathematics/fann/files/fann-1.2.0-setup.py +++ /dev/null @@ -1,46 +0,0 @@ -from distutils.core import setup, Extension
-from distutils.command.install_data import install_data
-from compiler.pycodegen import compileFile
-import glob
-import distutils
-import distutils.sysconfig
-import distutils.core
-import os
-
-DISTUTILS_DEBUG="True"
-
-VERSION='1.2.0'
-
-LONG_DESCRIPTION="""\
-Fast Artificial Neural Network Library implements multilayer
-artificial neural networks with support for both fully connected
-and sparsely connected networks. It includes a framework for easy
-handling of training data sets. It is easy to use, versatile, well
-documented, and fast.
-"""
-
-setup(
- name='pyfann',
- description='Fast Artificial Neural Network Library (fann)',
- long_description=LONG_DESCRIPTION,
- version=VERSION,
- author='Steffen Nissen',
- author_email='lukesky@diku.dk',
- maintainer='Gil Megidish',
- maintainer_email='gil@megidish.net',
- url='http://sourceforge.net/projects/fann/',
- license='GNU LESSER GENERAL PUBLIC LICENSE (LGPL)',
- # Description of the package in the distribution
- packages=['fann'],
- ext_package="fann",
- ext_modules=[
- Extension("_libfann", ["fann_helper.c","libfann.i"],
- include_dirs=["../src/include"],
- extra_link_args=['-L/usr/local/bin','-L/usr/bin','-L../src/include','-lpython2.3','-dll'],
- extra_objects=['/var/tmp/portage/fann-1.2.0/work/fann-1.2.0/src/fann_error.o',
- '../src/fann_io.o','../src/fann.o','../src/fann_options.o',
- '../src/fann_train_data.o','../src/fann_train.o'],
- )
- ],
- )
-
|