summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gluster/gfapi/__init__.py14
-rw-r--r--[-rwxr-xr-x]gluster/gfapi/api.py (renamed from gluster/api.py)0
-rw-r--r--gluster/gfapi/exceptions.py (renamed from gluster/exceptions.py)0
-rw-r--r--[-rwxr-xr-x]gluster/gfapi/gfapi.py (renamed from gluster/gfapi.py)8
-rw-r--r--gluster/gfapi/utils.py (renamed from gluster/utils.py)2
-rw-r--r--setup.py7
-rw-r--r--test/functional/libgfapi-python-tests.py4
-rw-r--r--test/unit/gluster/test_gfapi.py14
-rw-r--r--test/unit/gluster/test_utils.py4
9 files changed, 33 insertions, 20 deletions
diff --git a/gluster/gfapi/__init__.py b/gluster/gfapi/__init__.py
new file mode 100644
index 0000000..8d99bf2
--- /dev/null
+++ b/gluster/gfapi/__init__.py
@@ -0,0 +1,14 @@
+# Copyright (c) 2016 Red Hat, Inc.
+#
+# This file is part of libgfapi-python project which is a
+# subproject of GlusterFS ( www.gluster.org)
+#
+# This file is licensed to you under your choice of the GNU Lesser
+# General Public License, version 3 or any later version (LGPLv3 or
+# later), or the GNU General Public License, version 2 (GPLv2), in all
+# cases as published by the Free Software Foundation.
+
+__version__ = '1.0'
+
+from gfapi import File, Dir, DirEntry, Volume
+__all__ = ['File', 'Dir', 'DirEntry', 'Volume']
diff --git a/gluster/api.py b/gluster/gfapi/api.py
index c440de6..c440de6 100755..100644
--- a/gluster/api.py
+++ b/gluster/gfapi/api.py
diff --git a/gluster/exceptions.py b/gluster/gfapi/exceptions.py
index 05496f0..05496f0 100644
--- a/gluster/exceptions.py
+++ b/gluster/gfapi/exceptions.py
diff --git a/gluster/gfapi.py b/gluster/gfapi/gfapi.py
index 222f7a2..89d8388 100755..100644
--- a/gluster/gfapi.py
+++ b/gluster/gfapi/gfapi.py
@@ -16,11 +16,9 @@ import stat
import errno
from collections import Iterator
-from gluster import api
-from gluster.exceptions import LibgfapiException, Error
-from gluster.utils import validate_mount, validate_glfd
-
-__version__ = '1.0'
+from gluster.gfapi import api
+from gluster.gfapi.exceptions import LibgfapiException, Error
+from gluster.gfapi.utils import validate_mount, validate_glfd
# TODO: Move this utils.py
python_mode_to_os_flags = {}
diff --git a/gluster/utils.py b/gluster/gfapi/utils.py
index bc55184..a556a41 100644
--- a/gluster/utils.py
+++ b/gluster/gfapi/utils.py
@@ -11,7 +11,7 @@
import os
import errno
from functools import wraps
-from gluster.exceptions import VolumeNotMounted
+from gluster.gfapi.exceptions import VolumeNotMounted
def validate_mount(func):
diff --git a/setup.py b/setup.py
index 912959b..26871d7 100644
--- a/setup.py
+++ b/setup.py
@@ -12,11 +12,12 @@
import os
import re
-from setuptools import setup
+from setuptools import setup, find_packages
# Get version without importing.
-gfapi_file_path = os.path.join(os.path.dirname(__file__), 'gluster/gfapi.py')
+gfapi_file_path = os.path.join(os.path.dirname(__file__),
+ 'gluster/gfapi/__init__.py')
with open(gfapi_file_path) as f:
for line in f:
match = re.match(r"__version__.*'([0-9.]+)'", line)
@@ -36,7 +37,7 @@ setup(
author='Red Hat, Inc.',
author_email='gluster-devel@gluster.org',
url='http://www.gluster.org',
- packages=['gluster', ],
+ packages=find_packages(exclude=['test*']),
test_suite='nose.collector',
classifiers=[
'Development Status :: 5 - Production/Stable'
diff --git a/test/functional/libgfapi-python-tests.py b/test/functional/libgfapi-python-tests.py
index 8c62685..cf269d3 100644
--- a/test/functional/libgfapi-python-tests.py
+++ b/test/functional/libgfapi-python-tests.py
@@ -19,9 +19,9 @@ from test import get_test_config
from ConfigParser import NoSectionError, NoOptionError
from uuid import uuid4
-from gluster.api import Stat
+from gluster.gfapi.api import Stat
from gluster.gfapi import File, Volume, DirEntry
-from gluster.exceptions import LibgfapiException, Error
+from gluster.gfapi.exceptions import LibgfapiException, Error
config = get_test_config()
if config:
diff --git a/test/unit/gluster/test_gfapi.py b/test/unit/gluster/test_gfapi.py
index 15ce061..4b58597 100644
--- a/test/unit/gluster/test_gfapi.py
+++ b/test/unit/gluster/test_gfapi.py
@@ -18,8 +18,8 @@ import math
import errno
from gluster.gfapi import File, Dir, Volume, DirEntry
-from gluster import api
-from gluster.exceptions import LibgfapiException
+from gluster.gfapi import api
+from gluster.gfapi.exceptions import LibgfapiException
from nose import SkipTest
from mock import Mock, MagicMock, patch
from contextlib import nested
@@ -483,7 +483,7 @@ class TestVolume(unittest.TestCase):
mock_glfs_creat = Mock()
mock_glfs_creat.return_value = 2
- with patch("gluster.api.glfs_creat", mock_glfs_creat):
+ with patch("gluster.gfapi.api.glfs_creat", mock_glfs_creat):
with File(self.vol.open("file.txt", os.O_CREAT, 0644)) as f:
self.assertTrue(isinstance(f, File))
self.assertEqual(mock_glfs_creat.call_count, 1)
@@ -849,7 +849,7 @@ class TestVolume(unittest.TestCase):
mock_glfs_open = Mock()
mock_glfs_open.return_value = 2
- with patch("gluster.api.glfs_open", mock_glfs_open):
+ with patch("gluster.gfapi.api.glfs_open", mock_glfs_open):
with File(self.vol.open("file.txt", os.O_WRONLY)) as f:
self.assertTrue(isinstance(f, File))
self.assertEqual(mock_glfs_open.call_count, 1)
@@ -864,14 +864,14 @@ class TestVolume(unittest.TestCase):
with self.vol.open("file.txt", os.O_WRONLY) as fd:
self.assertEqual(fd, None)
- with patch("gluster.api.glfs_open", mock_glfs_open):
+ with patch("gluster.gfapi.api.glfs_open", mock_glfs_open):
self.assertRaises(OSError, assert_open)
def test_open_direct_success(self):
mock_glfs_open = Mock()
mock_glfs_open.return_value = 2
- with patch("gluster.api.glfs_open", mock_glfs_open):
+ with patch("gluster.gfapi.api.glfs_open", mock_glfs_open):
f = File(self.vol.open("file.txt", os.O_WRONLY))
self.assertTrue(isinstance(f, File))
self.assertEqual(mock_glfs_open.call_count, 1)
@@ -882,7 +882,7 @@ class TestVolume(unittest.TestCase):
mock_glfs_open = Mock()
mock_glfs_open.return_value = None
- with patch("gluster.api.glfs_open", mock_glfs_open):
+ with patch("gluster.gfapi.api.glfs_open", mock_glfs_open):
self.assertRaises(OSError, self.vol.open, "file.txt", os.O_RDONLY)
def test_opendir_success(self):
diff --git a/test/unit/gluster/test_utils.py b/test/unit/gluster/test_utils.py
index 446bcd9..e58e225 100644
--- a/test/unit/gluster/test_utils.py
+++ b/test/unit/gluster/test_utils.py
@@ -10,8 +10,8 @@
import unittest
-from gluster import utils
-from gluster.exceptions import VolumeNotMounted
+from gluster.gfapi import utils
+from gluster.gfapi.exceptions import VolumeNotMounted
class TestUtils(unittest.TestCase):