mirror of
https://github.com/arsenetar/send2trash.git
synced 2026-01-25 16:11:39 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd9183afe9 | ||
|
|
f6f63b1796 | ||
|
|
0974912e78 | ||
|
|
6c01453fd3 | ||
|
|
7cbefa4317 | ||
|
|
72bc94b48d | ||
|
|
35ad95bcd5 |
10
CHANGES.rst
10
CHANGES.rst
@@ -1,11 +1,17 @@
|
||||
Changes
|
||||
=======
|
||||
|
||||
Version 1.3.1 -- 2017/07/31
|
||||
---------------------------
|
||||
|
||||
* Throw ``WindowsError`` instead of ``OSError`` in ``plat_win``. (#7)
|
||||
* Fix ``TypeError`` on python 2 in ``plat_other``. (#12)
|
||||
|
||||
Version 1.3.0 -- 2013/07/19
|
||||
---------------------------
|
||||
|
||||
* Added support for Gnome's GIO.
|
||||
* Merged Python 3 and Python 2 vesion in a single codebase.
|
||||
* Merged Python 3 and Python 2 versions in a single codebase.
|
||||
|
||||
Version 1.2.0 -- 2011/03/16
|
||||
---------------------------
|
||||
@@ -30,4 +36,4 @@ Version 1.0.1 -- 2010/04/19
|
||||
Version 1.0.0 -- 2010/04/07
|
||||
---------------------------
|
||||
|
||||
* Initial Release
|
||||
* Initial Release
|
||||
|
||||
@@ -27,6 +27,9 @@ except ImportError:
|
||||
# Python 2
|
||||
from urllib import quote
|
||||
|
||||
# PY2-PY3 compatibilty
|
||||
text_type = str if sys.version_info[0] == 3 else unicode
|
||||
|
||||
FILES_DIR = 'files'
|
||||
INFO_DIR = 'info'
|
||||
INFO_SUFFIX = '.trashinfo'
|
||||
@@ -37,7 +40,7 @@ HOMETRASH = op.join(XDG_DATA_HOME, 'Trash')
|
||||
|
||||
uid = os.getuid()
|
||||
TOPDIR_TRASH = '.Trash'
|
||||
TOPDIR_FALLBACK = '.Trash-' + str(uid)
|
||||
TOPDIR_FALLBACK = '.Trash-' + text_type(uid)
|
||||
|
||||
def is_parent(parent, path):
|
||||
path = op.realpath(path) # In case it's a symlink
|
||||
@@ -48,7 +51,7 @@ def format_date(date):
|
||||
return date.strftime("%Y-%m-%dT%H:%M:%S")
|
||||
|
||||
def info_for(src, topdir):
|
||||
# ...it MUST not include a ".."" directory, and for files not "under" that
|
||||
# ...it MUST not include a ".." directory, and for files not "under" that
|
||||
# directory, absolute pathnames must be used. [2]
|
||||
if topdir is None or not is_parent(topdir, src):
|
||||
src = op.abspath(src)
|
||||
@@ -106,7 +109,7 @@ def find_ext_volume_global_trash(volume_root):
|
||||
if not op.isdir(trash_dir) or op.islink(trash_dir) or not (mode & stat.S_ISVTX):
|
||||
return None
|
||||
|
||||
trash_dir = op.join(trash_dir, str(uid))
|
||||
trash_dir = op.join(trash_dir, text_type(uid))
|
||||
try:
|
||||
check_create(trash_dir)
|
||||
except OSError:
|
||||
@@ -132,8 +135,8 @@ def get_dev(path):
|
||||
return os.lstat(path).st_dev
|
||||
|
||||
def send2trash(path):
|
||||
if not isinstance(path, str):
|
||||
path = str(path, sys.getfilesystemencoding())
|
||||
if not isinstance(path, text_type):
|
||||
path = text_type(path, sys.getfilesystemencoding())
|
||||
if not op.exists(path):
|
||||
raise OSError("File not found: %s" % path)
|
||||
# ...should check whether the user has the necessary permissions to delete
|
||||
|
||||
@@ -54,6 +54,4 @@ def send2trash(path):
|
||||
fileop.lpszProgressTitle = None
|
||||
result = SHFileOperationW(byref(fileop))
|
||||
if result:
|
||||
msg = "Couldn't perform operation. Error code: %d" % result
|
||||
raise OSError(msg)
|
||||
|
||||
raise WindowsError(None, None, path, result)
|
||||
|
||||
11
setup.py
11
setup.py
@@ -1,6 +1,3 @@
|
||||
import sys
|
||||
import os.path as op
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
CLASSIFIERS = [
|
||||
@@ -19,14 +16,14 @@ LONG_DESCRIPTION = open('README.rst', 'rt').read() + '\n\n' + open('CHANGES.rst'
|
||||
|
||||
setup(
|
||||
name='Send2Trash',
|
||||
version='1.3.0',
|
||||
author='Hardcoded Software',
|
||||
version='1.3.1',
|
||||
author='Virgil Dupras',
|
||||
author_email='hsoft@hardcoded.net',
|
||||
packages=['send2trash'],
|
||||
scripts=[],
|
||||
url='http://github.com/hsoft/send2trash',
|
||||
url='https://github.com/hsoft/send2trash',
|
||||
license='BSD License',
|
||||
description='Send file to trash natively under Mac OS X, Windows and Linux.',
|
||||
long_description=LONG_DESCRIPTION,
|
||||
classifiers=CLASSIFIERS,
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user