[Openlanhouse-development] SF.net SVN: openlanhouse:[291] trunk/openlh-core
Status: Pre-Alpha
Brought to you by:
n3rd3x
|
From: <n3...@us...> - 2008-10-11 17:46:07
|
Revision: 291
http://openlanhouse.svn.sourceforge.net/openlanhouse/?rev=291&view=rev
Author: n3rd3x
Date: 2008-10-11 17:46:00 +0000 (Sat, 11 Oct 2008)
Log Message:
-----------
Modified Paths:
--------------
trunk/openlh-core/configure.ac
trunk/openlh-core/src/OpenlhCore/__init__.py
trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py
trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py
trunk/openlh-core/src/OpenlhCore/net/request_handler.py
trunk/openlh-core/src/OpenlhCore/net/server.py
Added Paths:
-----------
trunk/openlh-core/src/OpenlhCore/Makefile.am
trunk/openlh-core/src/OpenlhCore/net/Makefile.am
trunk/openlh-core/src/OpenlhCore/net/backends/Makefile.am
trunk/openlh-core/src/OpenlhCore/net/certgen/Makefile.am
trunk/openlh-core/src/OpenlhCore/utils.py
Removed Paths:
-------------
trunk/openlh-core/src/OpenlhCore/net/certgen/base.py
Modified: trunk/openlh-core/configure.ac
===================================================================
--- trunk/openlh-core/configure.ac 2008-10-11 17:29:12 UTC (rev 290)
+++ trunk/openlh-core/configure.ac 2008-10-11 17:46:00 UTC (rev 291)
@@ -44,7 +44,9 @@
Makefile
src/Makefile
src/OpenlhCore/Makefile
-src/OpenlhCore/ui/Makefile
+src/OpenlhCore/net/Makefile
+src/OpenlhCore/net/backends/Makefile
+src/OpenlhCore/net/certgen/Makefile
src/OpenlhCore/config.py
])
Added: trunk/openlh-core/src/OpenlhCore/Makefile.am
===================================================================
--- trunk/openlh-core/src/OpenlhCore/Makefile.am (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/Makefile.am 2008-10-11 17:46:00 UTC (rev 291)
@@ -0,0 +1,7 @@
+SUBDIRS = net
+
+openlhdir = $(pythondir)/OpenlhCore
+openlh_PYTHON = \
+ __init__.py \
+ utils.py \
+ config.py
Modified: trunk/openlh-core/src/OpenlhCore/__init__.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/__init__.py 2008-10-11 17:29:12 UTC (rev 290)
+++ trunk/openlh-core/src/OpenlhCore/__init__.py 2008-10-11 17:46:00 UTC (rev 291)
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+__all__ = ("utils", "net")
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/Makefile.am
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/Makefile.am (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/Makefile.am 2008-10-11 17:46:00 UTC (rev 291)
@@ -0,0 +1,10 @@
+SUBDIRS = backends certgen
+
+openlhnetdir = $(pythondir)/OpenlhCore/net
+openlhnet_PYTHON = \
+ __init__.py \
+ client.py \
+ constants.py \
+ request_handler.py \
+ response.py \
+ server.py
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/backends/Makefile.am
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/backends/Makefile.am (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/backends/Makefile.am 2008-10-11 17:46:00 UTC (rev 291)
@@ -0,0 +1,6 @@
+
+openlhbackendsdir = $(pythondir)/OpenlhCore/net/backends
+openlhbackends_PYTHON = \
+ __init__.py \
+ gnutls_backend.py \
+ openssl_backend.py
\ No newline at end of file
Added: trunk/openlh-core/src/OpenlhCore/net/certgen/Makefile.am
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/Makefile.am (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/Makefile.am 2008-10-11 17:46:00 UTC (rev 291)
@@ -0,0 +1,6 @@
+
+openlhcertgendir = $(pythondir)/OpenlhCore/net/certgen
+openlhcertgen_PYTHON = \
+ __init__.py \
+ gnutls_certgen.py \
+ openssl_certgen.py
\ No newline at end of file
Modified: trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py 2008-10-11 17:29:12 UTC (rev 290)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/__init__.py 2008-10-11 17:46:00 UTC (rev 291)
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+# Copyright (C) 2008 Wilson Pinto Júnior <wi...@op...>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,4 +16,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-__all__ = ()
\ No newline at end of file
+__all__ = ("gnutls_certgen", "openssl_certgen")
Deleted: trunk/openlh-core/src/OpenlhCore/net/certgen/base.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/base.py 2008-10-11 17:29:12 UTC (rev 290)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/base.py 2008-10-11 17:46:00 UTC (rev 291)
@@ -1,17 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
\ No newline at end of file
Modified: trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py 2008-10-11 17:29:12 UTC (rev 290)
+++ trunk/openlh-core/src/OpenlhCore/net/certgen/gnutls_certgen.py 2008-10-11 17:46:00 UTC (rev 291)
@@ -16,8 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from OpenlhServer.utils import execute_command, is_in_path
-from OpenlhServer.globals import _
+from OpenlhCore.utils import execute_command, is_in_path
CERTTOOL_PATH = is_in_path("certtool")
@@ -25,7 +24,7 @@
bits, data):
if not CERTTOOL_PATH:
- raise SystemError(_("certtool is not installed, please install it"))
+ raise SystemError("certtool is not installed, please install it")
cmd = [CERTTOOL_PATH, "--generate-privkey", "--bits", str(bits)]
@@ -39,4 +38,4 @@
print "Certtool:%s\nPrivkey:%s\nSelfSigned:%s\nTemplate:%s\nBits:%d\n" % (CERTTOOL_PATH, privkey_path,
selfsigned_path,
template_path,
- bits)
\ No newline at end of file
+ bits)
Modified: trunk/openlh-core/src/OpenlhCore/net/request_handler.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/request_handler.py 2008-10-11 17:29:12 UTC (rev 290)
+++ trunk/openlh-core/src/OpenlhCore/net/request_handler.py 2008-10-11 17:46:00 UTC (rev 291)
@@ -25,13 +25,13 @@
from os import path as ospath
from threading import RLock
-from OpenlhServer.utils import DictLimited
+from OpenlhCore.utils import DictLimited
from xmlrpclib import loads as xmlpickler_loads
from xmlrpclib import dumps as xmlpickler_dumps
-from OpenlhServer.net.response import Response
-from OpenlhServer.net.constants import *
+from OpenlhCore.net.response import Response
+from OpenlhCore.net.constants import *
HashIDRegex = re.compile(r'-----HASH_ID=(?P<hash_id>\w+)-----(?P<data>(.*))')
@@ -468,4 +468,4 @@
def check_and_alert_size_remaining(self):
if self.current_size_remaining != 0:
self.logger.warning('size_remaining != 0, size_remaing = %d' % self.current_size_remaining)
-
\ No newline at end of file
+
Modified: trunk/openlh-core/src/OpenlhCore/net/server.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/net/server.py 2008-10-11 17:29:12 UTC (rev 290)
+++ trunk/openlh-core/src/OpenlhCore/net/server.py 2008-10-11 17:46:00 UTC (rev 291)
@@ -22,13 +22,13 @@
import traceback
try:
- from OpenlhServer.net.backends import gnutls_backend as gnutls
+ from OpenlhCore.net.backends import gnutls_backend as gnutls
except Exception, error:
print error
gnutls = None
try:
- from OpenlhServer.net.backends import openssl_backend as openssl #this backend is not working now
+ from OpenlhCore.net.backends import openssl_backend as openssl #this backend is not working now
except Exception, error:
print error
openssl = None
@@ -185,4 +185,4 @@
def closeall_connections(self):
for con in self.connected_clients:
- con.close()
\ No newline at end of file
+ con.close()
Added: trunk/openlh-core/src/OpenlhCore/utils.py
===================================================================
--- trunk/openlh-core/src/OpenlhCore/utils.py (rev 0)
+++ trunk/openlh-core/src/OpenlhCore/utils.py 2008-10-11 17:46:00 UTC (rev 291)
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2008 Wilson Pinto J\xFAnior <wi...@op...>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import subprocess
+import os
+
+def is_in_path(name_of_command, return_abs_path=True):
+ # if return_abs_path is True absolute path will be returned
+ # for name_of_command
+ # on failures False is returned
+
+ is_in_dir = False
+ found_in_which_dir = None
+ path = os.getenv('PATH').split(':')
+
+ for path_to_directory in path:
+ try:
+ contents = os.listdir(path_to_directory)
+
+ except OSError: # user can have something in PATH that is not a dir
+ pass
+
+ else:
+ is_in_dir = name_of_command in contents
+
+ if is_in_dir:
+ if return_abs_path:
+ found_in_which_dir = path_to_directory
+
+ break
+
+ if found_in_which_dir:
+ abs_path = os.path.join(path_to_directory, name_of_command)
+ return abs_path
+
+ else:
+ return is_in_dir
+
+def execute_command(cmd):
+ """
+ Execute command
+ """
+ if not isinstance(cmd, list):
+ cmd = [cmd]
+
+ env = os.environ
+ po = subprocess.Popen(cmd, stdin=None, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, env=env)
+
+ retval = po.wait()
+ (stdout, stderr) = po.communicate()
+
+ return (stdout, stderr, retval)
+
+class DictLimited:
+ def __init__(self, limit):
+ self._dict = dict()
+ self._limit = limit
+
+ def __setitem__(self, key, value):
+ if not key in self._dict:
+ assert len(self._dict) +1 <= self._limit, "this dict is full"
+ self._dict[key] = value
+
+ def __getitem__(self, key):
+ return self._dict[key]
+
+ def __delitem__(self, key):
+ self._dict.pop(key)
+
+ def __str__(self):
+ return "<DictLimited(%s)>" % self._dict.__repr__()
+
+ def __getattr__(self, attr_name):
+ return getattr(self._dict, attr_name)
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|