8000 Update fs.expose.ftp for compatibility with latest pyftpdlib. by travcunn · Pull Request #217 · PyFilesystem/pyfilesystem · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

Update fs.expose.ftp for compatibility with latest pyftpdlib. #217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
08bac4b
Update fs.expose.ftp for compatibility with latest pyftpdlib.
Oct 7, 2015
23030b3
Update setup.py
Oct 8, 2015
5c0fb2e
Update __init__.py
Oct 8, 2015
e76c471
Fix OSFS.getsyspath unicode problems.
Dec 9, 2015
17aa578
Revert "Fix OSFS.getsyspath unicode problems."
Dec 9, 2015
6fc97b5
Add some basic information instead of returning blank info for the root
Apr 18, 2016
8e6ae64
Merge pull request #1 from smartfile/add-basic-info
Apr 18, 2016
c913806
bypass lock on move()
giampaolo May 3, 2016
e733d72
bypass lock on setcontents()
giampaolo May 3, 2016
41ba462
bypass_lock on movedir
giampaolo May 3, 2016
af1afdd
Merge pull request #2 from smartfile/lockfs
giampaolo May 6, 2016
d733cab
modify all setcontents() signatures in order to accept a 'bypass_lock…
giampaolo May 6, 2016
c8d2708
fix import error
giampaolo May 7, 2016
e91a4c7
use **kwargs in copy() signature
giampaolo May 7, 2016
d2e18b9
add **kwargs to removedir() signature
giampaolo May 7, 2016
8d2a2b4
add **kwargs to movedir() signature
giampaolo May 7, 2016
240b0e3
add Maefile + test runner
giampaolo May 7, 2016
051124c
Merge pull request #3 from smartfile/bypass-lock-arg
May 11, 2016
378c403
skip failing tests which are also failing on pyfilesystem master branch
giampaolo May 11, 2016
eae6850
add pyftpdlib to setup.py requirements
giampaolo May 11, 2016
999b814
skip libarchive test if not available (and we don't use it anyway=
giampaolo May 11, 2016
2df37d5
skip test failing on master
giampaolo May 11, 2016
0c6119e
Increase FTP read() chunk size.
Jun 9, 2016
f20a573
Update chunk size for FTP.
Jun 9, 2016
5291024
fix ftpfs bug not considering the second exception
giampaolo Jun 9, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
PYTHON=python
TSCRIPT=fs/tests/runner.py

all: test

clean:
rm -f `find . -type f -name \*.py[co]`
rm -f `find . -type f -name \*.so`
rm -f `find . -type f -name \*.~`
rm -f `find . -type f -name \*.orig`
rm -f `find . -type f -name \*.bak`
rm -f `find . -type f -name \*.rej`
rm -rf `find . -type d -name __pycache__`
rm -rf *.egg-info
rm -rf build
rm -rf dist

install:
$(PYTHON) setup.py build
$(PYTHON) setup.py develop

test: install
$(PYTHON) $(TSCRIPT)
2 changes: 1 addition & 1 deletion fs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

"""

__version__ = "0.5.4a1"
__version__ = "0.5.4"
__author__ = "Will McGugan (will@willmcgugan.com)"

# provide these by default so people can use 'fs.path.basename' etc.
Expand Down
35 changes: 22 additions & 13 deletions fs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ def makedir(self, path, recursive=False, allow_recreate=False):
"""
raise UnsupportedError("make directory")

def remove(self, path):
def remove(self, path, **kwargs):
"""Remove a file from the filesystem.

:param path: Path of the resource to remove
Expand All @@ -654,7 +654,7 @@ def remove(self, path):
"""
raise UnsupportedError("remove resource")

def removedir(self, path, recursive=False, force=False):
def removedir(self, path, recursive=False, force=False, **kwargs):
"""Remove a directory from the filesystem

:param path: path of the directory to remove
Expand Down Expand Up @@ -802,7 +802,8 @@ def _setcontents(self,
errors=None,
chunk_size=1024 * 64,
progress_callback=None,
finished_callback=None):
finished_callback=None,
**kwargs):
"""Does the work of setcontents. Factored out, so that `setcontents_async` can use it"""
if progress_callback is None:
progress_callback = lambda bytes_written: None
Expand All @@ -822,9 +823,10 @@ def _setcontents(self,
read = data.read
chunk = read(chunk_size)
if isinstance(chunk, six.text_type):
f = self.open(path, 'wt', encoding=encoding, errors=errors)
f = self.open(path, 'wt', encoding=encoding, errors=errors,
**kwargs)
else:
f = self.open(path, 'wb')
f = self.open(path, 'wb', **kwargs)
write = f.write
try:
while chunk:
Expand All @@ -848,7 +850,8 @@ def _setcontents(self,
finished_callback()
return bytes_written

def setcontents(self, path, data=b'', encoding=None, errors=None, chunk_size=1024 * 64):
def setcontents(self, path, data=b'', encoding=None, errors=None,
chunk_size=1024 * 64, **kwargs):
"""A convenience method to create a new file from a string or file-like object

:param path: a path of the file to create
Expand All @@ -858,7 +861,7 @@ def setcontents(self, path, data=b'', encoding=None, errors=None, chunk_size=102
:param chunk_size: Number of bytes to read in a chunk, if the implementation has to resort to a read / copy loop

"""
return self._setcontents(path, data, encoding=encoding, errors=errors, chunk_size=1024 * 64)
return self._setcontents(path, data, encoding=encoding, errors=errors, chunk_size=1024 * 64, **kwargs)

def setcontents_async(self,
path,
Expand Down Expand Up @@ -1110,7 +1113,7 @@ def getsize(self, path):
raise OperationFailedError("get size of resource", path)
return size

def copy(self, src, dst, overwrite=False, chunk_size=1024 * 64):
def copy(self, src, dst, overwrite=False, chunk_size=1024 * 64, **kwargs):
"""Copies a file from src to dst.

:param src: the source path
Expand Down Expand Up @@ -1143,7 +1146,8 @@ def copy(self, src, dst, overwrite=False, chunk_size=1024 * 64):
src_file = None
try:
src_file = self.open(src, "rb")
self.setcontents(dst, src_file, chunk_size=chunk_size)
self.setcontents(dst, src_file, chunk_size=chunk_size,
bypass_lock=True)
except ResourceNotFoundError:
if self.exists(src) and not self.exists(dirname(dst)):
raise ParentDirectoryMissingError(dst)
Expand Down Expand Up @@ -1205,10 +1209,12 @@ def move(self, src, dst, overwrite=False, chunk_size=16384):
return
except OSError:
pass
self.copy(src, dst, overwrite=overwrite, chunk_size=chunk_size)
self.remove(src)
self.copy(src, dst, overwrite=overwrite, chunk_size=chunk_size,
bypass_lock=True)
self.remove(src, bypass_lock=True)

def movedir(self, src, dst, overwrite=False, ignore_errors=False, chunk_size=16384):
def movedir(self, src, dst, overwrite=False, ignore_errors=False,
chunk_size=16384, **kwargs):
"""moves a directory from one location to another.

:param src: source directory path
Expand Down Expand Up @@ -1274,7 +1280,10 @@ def movefile_noerrors(src, dst, **kwargs):
dst_filename = pathjoin(dst_dirpath, filename)
movefile(src_filename, dst_filename, overwrite=overwrite, chunk_size=chunk_size)

self.removedir(dirname)
if dirname == src:
self.removedir(dirname, bypass_lock=True)
else:
self.removedir(dirname)

def copydir(self, src, dst, overwrite=False, ignore_errors=False, chunk_size=16384):
"""copies a directory from one location to another.
Expand Down
2 changes: 1 addition & 1 deletion fs/contrib/archivefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def getsize(self, path):
else:
return fs.getsize(delegate_path)

def remove(self, path):
def remove(self, path, **kwargs):
"""A remove() override that deletes an archive directly. It is not fooled
by a mounted archive. If the path is not an archive, the call is delegated."""
if libarchive.is_archive_name(path) and self.ismount(path):
Expand Down
10 changes: 6 additions & 4 deletions fs/contrib/davfs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ def new_close():
msg = str(e)
raise RemoteConnectionError("",msg=msg,details=e)

def setcontents(self,path, data=b'', encoding=None, errors=None, chunk_size=1024 * 64):
def setcontents(self,path, data=b'', encoding=None, errors=None,
chunk_size=1024 * 64, **kwargs):
if isinstance(data, six.text_type):
data = data.encode(encoding=encoding, errors=errors)
resp = self._request(path, "PUT", data)
Expand Down Expand Up @@ -576,7 +577,7 @@ def remove(self,path):
raise_generic_error(response,"remove",path)
return True

def removedir(self,path,recursive=False,force=False):
def removedir(self,path,recursive=False,force=False,**kwargs):
if self.isfile(path):
raise ResourceInvalidError(path)
if not force and self.listdir(path):
Expand Down Expand Up @@ -678,7 +679,7 @@ def _info_from_propfind(self,res):
return info


def copy(self,src,dst,overwrite=False,chunk_size=None):
def copy(self, src, dst, overwrite=False, chunk_size=None, **kwargs):
if self.isdir(src):
msg = "Source is not a file: %(path)s"
raise ResourceInvalidError(src, msg=msg)
Expand Down Expand Up @@ -711,7 +712,8 @@ def move(self,src,dst,overwrite=False,chunk_size=None):
raise ResourceInvalidError(src, msg=msg)
self._move(src,dst,overwrite=overwrite)

def movedir(self,src,dst,overwrite=False,ignore_errors=False,chunk_size=0):
def movedir(self,src,dst,overwrite=False,ignore_errors=False,chunk_size=0,
**kwargs):
if self.isfile(src):
msg = "Source is not a directory: %(path)s"
raise ResourceInvalidError(src, msg=msg)
Expand Down
Loading
0