From 4439f0b487efe0eb18e752cb6c3c11d91d298050 Mon Sep 17 00:00:00 2001 From: Diego Argueta Date: Wed, 31 Jul 2019 11:40:43 -0700 Subject: [PATCH 1/4] Fix namespacing issue with package name --- .travis.yml | 2 +- fs/__init__.py | 1 + {dropboxfs => fs/dropboxfs}/__init__.py | 0 {dropboxfs => fs/dropboxfs}/dropboxfs.py | 9 +++------ {dropboxfs => fs/dropboxfs}/opener.py | 3 +-- {dropboxfs => fs/dropboxfs}/tests/__init__.py | 0 {dropboxfs => fs/dropboxfs}/tests/test_dropboxfs.py | 2 +- {dropboxfs => fs/dropboxfs}/tests/testone.py | 5 +---- setup.cfg | 7 ++++--- 9 files changed, 12 insertions(+), 17 deletions(-) create mode 100644 fs/__init__.py rename {dropboxfs => fs/dropboxfs}/__init__.py (100%) rename {dropboxfs => fs/dropboxfs}/dropboxfs.py (97%) rename {dropboxfs => fs/dropboxfs}/opener.py (81%) rename {dropboxfs => fs/dropboxfs}/tests/__init__.py (100%) rename {dropboxfs => fs/dropboxfs}/tests/test_dropboxfs.py (95%) rename {dropboxfs => fs/dropboxfs}/tests/testone.py (51%) diff --git a/.travis.yml b/.travis.yml index b6f234e..a96ed38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ install: - pip install . script: - - pytest -v --reruns 5 dropboxfs/tests/test_dropboxfs.py + - pytest -v --reruns 5 fs/dropboxfs/tests/test_dropboxfs.py after_success: - coveralls diff --git a/fs/__init__.py b/fs/__init__.py new file mode 100644 index 0000000..de40ea7 --- /dev/null +++ b/fs/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/dropboxfs/__init__.py b/fs/dropboxfs/__init__.py similarity index 100% rename from dropboxfs/__init__.py rename to fs/dropboxfs/__init__.py diff --git a/dropboxfs/dropboxfs.py b/fs/dropboxfs/dropboxfs.py similarity index 97% rename from dropboxfs/dropboxfs.py rename to fs/dropboxfs/dropboxfs.py index 825517f..3d155e9 100644 --- a/dropboxfs/dropboxfs.py +++ b/fs/dropboxfs/dropboxfs.py @@ -1,22 +1,19 @@ import logging import threading -from contextlib import closing, contextmanager +from contextlib import closing from datetime import datetime from io import BytesIO -import dropbox import six from dropbox import Dropbox from dropbox.exceptions import ApiError -from dropbox.files import (DownloadError, FileMetadata, FolderMetadata, - LookupError, WriteMode) +from dropbox.files import (FileMetadata, FolderMetadata, LookupError, WriteMode) from fs import errors from fs.base import FS -from fs.enums import ResourceType, Seek +from fs.enums import ResourceType from fs.info import Info from fs.mode import Mode from fs.subfs import SubFS -from fs.time import datetime_to_epoch, epoch_to_datetime log = logging.getLogger(__name__) log.setLevel(logging.DEBUG) diff --git a/dropboxfs/opener.py b/fs/dropboxfs/opener.py similarity index 81% rename from dropboxfs/opener.py rename to fs/dropboxfs/opener.py index 8723338..1648601 100644 --- a/dropboxfs/opener.py +++ b/fs/dropboxfs/opener.py @@ -4,8 +4,7 @@ class DropboxOpener(Opener): protocols = ["dropbox"] - @staticmethod - def open_fs(fs_url, parse_result, writeable, create, cwd): + def open_fs(self, fs_url, parse_result, writeable, create, cwd): from .dropboxfs import DropboxFS _, _, directory = parse_result.resource.partition("/") diff --git a/dropboxfs/tests/__init__.py b/fs/dropboxfs/tests/__init__.py similarity index 100% rename from dropboxfs/tests/__init__.py rename to fs/dropboxfs/tests/__init__.py diff --git a/dropboxfs/tests/test_dropboxfs.py b/fs/dropboxfs/tests/test_dropboxfs.py similarity index 95% rename from dropboxfs/tests/test_dropboxfs.py rename to fs/dropboxfs/tests/test_dropboxfs.py index c33d6b3..6b9f29b 100644 --- a/dropboxfs/tests/test_dropboxfs.py +++ b/fs/dropboxfs/tests/test_dropboxfs.py @@ -6,7 +6,7 @@ from dropbox import create_session from fs.test import FSTestCases -from dropboxfs.dropboxfs import DropboxFS +from fs.dropboxfs.dropboxfs import DropboxFS def join(a, b): diff --git a/dropboxfs/tests/testone.py b/fs/dropboxfs/tests/testone.py similarity index 51% rename from dropboxfs/tests/testone.py rename to fs/dropboxfs/tests/testone.py index ce7777e..738725b 100644 --- a/dropboxfs/tests/testone.py +++ b/fs/dropboxfs/tests/testone.py @@ -1,7 +1,4 @@ -from fs.base import FS - -from dropboxfs.dropboxfs import DropboxFS -from dropboxfs.tests.test_dropboxfs import TestDropboxFS +from fs.dropboxfs.tests.test_dropboxfs import TestDropboxFS def main(): diff --git a/setup.cfg b/setup.cfg index a426d1f..d346dca 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,7 +22,6 @@ description = Dropbox support for pyfilesystem2 license = MIT long_description = file: README.rst, HISTORY.rst name = fs.dropboxfs -packages = find: platforms = any url = http://pypi.python.org/pypi/fs.dropboxfs/ version = 0.2.2-post1 @@ -32,7 +31,9 @@ install_requires = dropbox>=8.0, <10 fs>=2.0.26,<2.5 six>=1.9 -python_requires = >=2.7.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* +namespace_packages = fs +packages = find: +python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* tests_require = pytest==4.3.1 pytest-randomly==1.2.3 ; python_version<="3.4" @@ -41,7 +42,7 @@ tests_require = [options.entry_points] fs.opener = - dropbox = dropboxfs.opener:DropboxOpener + dropbox = fs.dropboxfs.opener:DropboxOpener [options.packages.find] exclude = tests From d7a146522d121646c59580451edacac1210dd9ab Mon Sep 17 00:00:00 2001 From: Diego Argueta Date: Wed, 31 Jul 2019 12:00:25 -0700 Subject: [PATCH 2/4] Update history and version number --- HISTORY.rst | 9 +++++++++ setup.cfg | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 871cc76..07e1cb1 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,15 @@ Release History =============== +0.3.0 +----- + +**Breaking**: + +Moved ``dropboxfs`` module inside ``fs`` to be consistent with its namespacing. +Fixes `#6 `_. Imports must +now be from `fs.dropboxfs` instead of `dropboxfs`. + 0.2.2-post1 ----------- diff --git a/setup.cfg b/setup.cfg index d346dca..42815b3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,7 +24,7 @@ long_description = file: README.rst, HISTORY.rst name = fs.dropboxfs platforms = any url = http://pypi.python.org/pypi/fs.dropboxfs/ -version = 0.2.2-post1 +version = 0.3.0 [options] install_requires = From 1bba86933145d8dafc455aa859fac4d4919c568b Mon Sep 17 00:00:00 2001 From: Diego Argueta Date: Wed, 31 Jul 2019 16:33:11 -0700 Subject: [PATCH 3/4] Attempt to fix Travis test setup issue. --- .travis.yml | 7 ++++--- fs/dropboxfs/__init__.py | 2 ++ fs/dropboxfs/tests/test_dropboxfs.py | 2 +- setup.py | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index a96ed38..515b89d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,15 +11,16 @@ python: - 'pypy' - 'pypy3.5' env: + global: - DROPBOX_ACCESS_TOKEN=GiQj7BV19aAAAAAAAAAACAevudx3Rxyca3vKenwRV9suPJ2sWKw3Bm6rC9CpxDM2 - + - PYTHONPATH=. install: - pip install -U pip setuptools wheel pytest-rerunfailures pytest - - pip install . + - pip install -e . script: - - pytest -v --reruns 5 fs/dropboxfs/tests/test_dropboxfs.py + - pytest -v --reruns 5 fs/dropboxfs/tests after_success: - coveralls diff --git a/fs/dropboxfs/__init__.py b/fs/dropboxfs/__init__.py index e69de29..db648ba 100644 --- a/fs/dropboxfs/__init__.py +++ b/fs/dropboxfs/__init__.py @@ -0,0 +1,2 @@ +from .dropboxfs import DropboxFile +from .dropboxfs import DropboxFS diff --git a/fs/dropboxfs/tests/test_dropboxfs.py b/fs/dropboxfs/tests/test_dropboxfs.py index 6b9f29b..7e16416 100644 --- a/fs/dropboxfs/tests/test_dropboxfs.py +++ b/fs/dropboxfs/tests/test_dropboxfs.py @@ -6,7 +6,7 @@ from dropbox import create_session from fs.test import FSTestCases -from fs.dropboxfs.dropboxfs import DropboxFS +from fs.dropboxfs import DropboxFS def join(a, b): diff --git a/setup.py b/setup.py index 7ee8bda..99c211f 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -from setuptools import setup, find_packages +from setuptools import setup -setup(test_suite='dropboxfs.tests') +setup(test_suite='fs.dropboxfs.tests') From cd0e97dff79d80d36b9139a12bee962a2adb3d11 Mon Sep 17 00:00:00 2001 From: Diego Argueta Date: Tue, 13 Aug 2019 13:46:03 -0700 Subject: [PATCH 4/4] Package detection fixes --- .travis.yml | 2 +- fs/dropboxfs/tests/testone.py | 11 ----------- setup.cfg | 5 +---- {fs/dropboxfs/tests => tests}/__init__.py | 0 {fs/dropboxfs/tests => tests}/test_dropboxfs.py | 0 5 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 fs/dropboxfs/tests/testone.py rename {fs/dropboxfs/tests => tests}/__init__.py (100%) rename {fs/dropboxfs/tests => tests}/test_dropboxfs.py (100%) diff --git a/.travis.yml b/.travis.yml index 515b89d..24c0ffe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ install: - pip install -e . script: - - pytest -v --reruns 5 fs/dropboxfs/tests + - pytest -v --reruns 5 tests after_success: - coveralls diff --git a/fs/dropboxfs/tests/testone.py b/fs/dropboxfs/tests/testone.py deleted file mode 100644 index 738725b..0000000 --- a/fs/dropboxfs/tests/testone.py +++ /dev/null @@ -1,11 +0,0 @@ -from fs.dropboxfs.tests.test_dropboxfs import TestDropboxFS - - -def main(): - ts = TestDropboxFS() - ts.fs = ts.make_fs() - ts.test_unicode_path() - - -if __name__ == "__main__": - main() diff --git a/setup.cfg b/setup.cfg index 42815b3..0651af0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,7 +32,7 @@ install_requires = fs>=2.0.26,<2.5 six>=1.9 namespace_packages = fs -packages = find: +packages = fs.dropboxfs python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* tests_require = pytest==4.3.1 @@ -43,6 +43,3 @@ tests_require = [options.entry_points] fs.opener = dropbox = fs.dropboxfs.opener:DropboxOpener - -[options.packages.find] -exclude = tests diff --git a/fs/dropboxfs/tests/__init__.py b/tests/__init__.py similarity index 100% rename from fs/dropboxfs/tests/__init__.py rename to tests/__init__.py diff --git a/fs/dropboxfs/tests/test_dropboxfs.py b/tests/test_dropboxfs.py similarity index 100% rename from fs/dropboxfs/tests/test_dropboxfs.py rename to tests/test_dropboxfs.py