From c9ee6eca44c4126dcb5efa3dab06270f88ae80e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Mon, 27 Jul 2015 15:16:00 -0400
Subject: [PATCH] move python to top directory

---
 Makefile.am                                   |  6 +++++
 configure.ac                                  |  2 +-
 {tools/python => python}/Makefile.am          |  0
 {tools/python => python}/opendht.pyx          |  7 +++---
 {tools/python => python}/setup.py             |  5 +++-
 .../tests => python/tools}/benchmark.py       |  0
 .../tests => python/tools}/dhtnetwork.py      |  0
 .../python/tests => python/tools}/dummy_if.py |  0
 {tools/python => python/tools}/scanner.py     | 25 ++++++++++++++++++-
 tools/Makefile.am                             |  4 ---
 10 files changed, 39 insertions(+), 10 deletions(-)
 rename {tools/python => python}/Makefile.am (100%)
 rename {tools/python => python}/opendht.pyx (98%)
 rename {tools/python => python}/setup.py (88%)
 rename {tools/python/tests => python/tools}/benchmark.py (100%)
 mode change 100644 => 100755
 rename {tools/python/tests => python/tools}/dhtnetwork.py (100%)
 mode change 100644 => 100755
 rename {tools/python/tests => python/tools}/dummy_if.py (100%)
 rename {tools/python => python/tools}/scanner.py (82%)
 mode change 100644 => 100755

diff --git a/Makefile.am b/Makefile.am
index c23caf7e..e764ea6d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,13 @@
 SUBDIRS = src
+
 if ENABLE_TOOLS
 SUBDIRS += tools
 endif
+
+if USE_CYTHON
+SUBDIRS += python
+endif
+
 if HAVE_DOXYGEN
 SUBDIRS += doc
 endif
diff --git a/configure.ac b/configure.ac
index d2c87bcc..3e156ce5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,7 +78,7 @@ AC_ARG_ENABLE([tools], AS_HELP_STRING([--disable-tools],[Disable tools (CLI DHT
 AM_CONDITIONAL(ENABLE_TOOLS, test x$build_tools == xyes)
 
 AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile doc/Makefile])])
-AM_COND_IF([USE_CYTHON], [AC_CONFIG_FILES([tools/python/Makefile])])
+AM_COND_IF([USE_CYTHON], [AC_CONFIG_FILES([python/Makefile])])
 
 AC_CONFIG_FILES([Makefile
                  src/Makefile
diff --git a/tools/python/Makefile.am b/python/Makefile.am
similarity index 100%
rename from tools/python/Makefile.am
rename to python/Makefile.am
diff --git a/tools/python/opendht.pyx b/python/opendht.pyx
similarity index 98%
rename from tools/python/opendht.pyx
rename to python/opendht.pyx
index 8f4f8787..e745b0ab 100644
--- a/tools/python/opendht.pyx
+++ b/python/opendht.pyx
@@ -5,8 +5,10 @@
 # distutils: libraries = opendht gnutls
 # cython: language_level=3
 #
-# opendht.pyx - Copyright 2015 by Guillaume Roguez <yomgui1 AT gmail DOT com>
-# A Python3 wrapper to access to OpenDHT API
+# Copyright (c) 2015 Savoir-Faire Linux Inc. 
+# Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
+# Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
+#
 # This wrapper is written for Cython 0.22
 # 
 # This file is part of OpenDHT Python Wrapper.
@@ -25,7 +27,6 @@
 #    along with OpenDHT Python Wrapper. If not, see <http://www.gnu.org/licenses/>.
 #
 
-
 from libc.stdint cimport *
 from libcpp.string cimport string
 from libcpp.vector cimport vector
diff --git a/tools/python/setup.py b/python/setup.py
similarity index 88%
rename from tools/python/setup.py
rename to python/setup.py
index 82f8ede3..29a416a3 100644
--- a/tools/python/setup.py
+++ b/python/setup.py
@@ -1,4 +1,7 @@
-# This file is copyright 2015 by Guillaume Roguez <yomgui1 AT gmail DOT com>
+# Copyright (c) 2015 Savoir-Faire Linux Inc. 
+# Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
+# Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
+#
 # A Python3 wrapper to access to OpenDHT API
 # This wrapper is written for Cython 0.22
 #
diff --git a/tools/python/tests/benchmark.py b/python/tools/benchmark.py
old mode 100644
new mode 100755
similarity index 100%
rename from tools/python/tests/benchmark.py
rename to python/tools/benchmark.py
diff --git a/tools/python/tests/dhtnetwork.py b/python/tools/dhtnetwork.py
old mode 100644
new mode 100755
similarity index 100%
rename from tools/python/tests/dhtnetwork.py
rename to python/tools/dhtnetwork.py
diff --git a/tools/python/tests/dummy_if.py b/python/tools/dummy_if.py
similarity index 100%
rename from tools/python/tests/dummy_if.py
rename to python/tools/dummy_if.py
diff --git a/tools/python/scanner.py b/python/tools/scanner.py
old mode 100644
new mode 100755
similarity index 82%
rename from tools/python/scanner.py
rename to python/tools/scanner.py
index 3c919825..439ba720
--- a/tools/python/scanner.py
+++ b/python/tools/scanner.py
@@ -1,7 +1,30 @@
-import time
+#!/usr/bin/env python3
+# Copyright (c) 2015 Savoir-Faire Linux Inc.
+# Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERWISE
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+import time, sys
 from pprint import pprint
 from math import cos, sin, pi
 
+sys.path.append('..')
 from opendht import *
 
 import numpy as np
diff --git a/tools/Makefile.am b/tools/Makefile.am
index e4f7a934..a4cf1f08 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,7 +1,3 @@
-if USE_CYTHON
-SUBDIRS = python
-endif
-
 libexec_PROGRAMS = dhtnode dhtchat dhtscanner
 
 AM_CPPFLAGS = -I../include
-- 
GitLab