mirror of
https://github.com/arsenetar/send2trash.git
synced 2026-03-13 03:01:37 +00:00
Compare commits
6 Commits
d0e4890a4d
...
1.8.1b0
| Author | SHA1 | Date | |
|---|---|---|---|
|
2aa834be94
|
|||
|
5e4517aa53
|
|||
|
62849fba0b
|
|||
|
74f2dff57b
|
|||
|
922fc0342a
|
|||
| 1d1b8755a9 |
71
.github/workflows/codeql-analysis.yml
vendored
Normal file
71
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
#
|
||||||
|
# ******** NOTE ********
|
||||||
|
# We have attempted to detect the languages in your repository. Please check
|
||||||
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
|
# supported CodeQL languages.
|
||||||
|
#
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ master ]
|
||||||
|
schedule:
|
||||||
|
- cron: '25 5 * * 4'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'python' ]
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||||
|
# Learn more:
|
||||||
|
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
|
#- run: |
|
||||||
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
language: python
|
language: python
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- python: "3.4"
|
|
||||||
- python: "2.7"
|
- python: "2.7"
|
||||||
arch: ppc64le
|
arch: ppc64le
|
||||||
- python: "3.6"
|
- python: "3.6"
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
Changes
|
Changes
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
Version 1.8.1b0 -- 2021/09/20
|
||||||
|
-----------------------------
|
||||||
|
* Add fallback to HOMETRASH when cross device errors happen in plat_other (#26, $41, #63)
|
||||||
|
|
||||||
Version 1.8.0 -- 2021/08/08
|
Version 1.8.0 -- 2021/08/08
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ from __future__ import unicode_literals
|
|||||||
import errno
|
import errno
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import os.path as op
|
import os.path as op
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import stat
|
import stat
|
||||||
@@ -95,7 +96,7 @@ def check_create(dir):
|
|||||||
os.makedirs(dir, 0o700)
|
os.makedirs(dir, 0o700)
|
||||||
|
|
||||||
|
|
||||||
def trash_move(src, dst, topdir=None):
|
def trash_move(src, dst, topdir=None, cross_dev=False):
|
||||||
filename = op.basename(src)
|
filename = op.basename(src)
|
||||||
filespath = op.join(dst, FILES_DIR)
|
filespath = op.join(dst, FILES_DIR)
|
||||||
infopath = op.join(dst, INFO_DIR)
|
infopath = op.join(dst, INFO_DIR)
|
||||||
@@ -112,14 +113,18 @@ def trash_move(src, dst, topdir=None):
|
|||||||
|
|
||||||
with open(op.join(infopath, destname + INFO_SUFFIX), "w") as f:
|
with open(op.join(infopath, destname + INFO_SUFFIX), "w") as f:
|
||||||
f.write(info_for(src, topdir))
|
f.write(info_for(src, topdir))
|
||||||
os.rename(src, op.join(filespath, destname))
|
destpath = op.join(filespath, destname)
|
||||||
|
if cross_dev:
|
||||||
|
shutil.move(src, destpath)
|
||||||
|
else:
|
||||||
|
os.rename(src, destpath)
|
||||||
|
|
||||||
|
|
||||||
def find_mount_point(path):
|
def find_mount_point(path):
|
||||||
# Even if something's wrong, "/" is a mount point, so the loop will exit.
|
# Even if something's wrong, "/" is a mount point, so the loop will exit.
|
||||||
# Use realpath in case it's a symlink
|
# Use realpath in case it's a symlink
|
||||||
path = op.realpath(path) # Required to avoid infinite loop
|
path = op.realpath(path) # Required to avoid infinite loop
|
||||||
while not op.ismount(path):
|
while not op.ismount(path): # Note ismount() does not always detect mounts
|
||||||
path = op.split(path)[0]
|
path = op.split(path)[0]
|
||||||
return path
|
return path
|
||||||
|
|
||||||
@@ -206,4 +211,11 @@ def send2trash(paths):
|
|||||||
if trash_dev != path_dev:
|
if trash_dev != path_dev:
|
||||||
raise OSError("Couldn't find mount point for %s" % path)
|
raise OSError("Couldn't find mount point for %s" % path)
|
||||||
dest_trash = find_ext_volume_trash(topdir)
|
dest_trash = find_ext_volume_trash(topdir)
|
||||||
|
try:
|
||||||
trash_move(path_b, dest_trash, topdir)
|
trash_move(path_b, dest_trash, topdir)
|
||||||
|
except OSError as error:
|
||||||
|
# Cross link errors default back to HOMETRASH
|
||||||
|
if error.errno == errno.EXDEV:
|
||||||
|
trash_move(path_b, HOMETRASH_B, XDG_DATA_HOME, cross_dev=True)
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = Send2Trash
|
name = Send2Trash
|
||||||
version = 1.8.0
|
version = 1.8.1b0
|
||||||
url = https://github.com/arsenetar/send2trash
|
url = https://github.com/arsenetar/send2trash
|
||||||
project_urls =
|
project_urls =
|
||||||
Bug Reports = https://github.com/arsenetar/send2trash/issues
|
Bug Reports = https://github.com/arsenetar/send2trash/issues
|
||||||
@@ -20,7 +20,6 @@ classifiers =
|
|||||||
Operating System :: POSIX
|
Operating System :: POSIX
|
||||||
Programming Language :: Python :: 2.7
|
Programming Language :: Python :: 2.7
|
||||||
Programming Language :: Python :: 3
|
Programming Language :: Python :: 3
|
||||||
Programming Language :: Python :: 3.4
|
|
||||||
Programming Language :: Python :: 3.5
|
Programming Language :: Python :: 3.5
|
||||||
Programming Language :: Python :: 3.6
|
Programming Language :: Python :: 3.6
|
||||||
Programming Language :: Python :: 3.7
|
Programming Language :: Python :: 3.7
|
||||||
@@ -32,6 +31,7 @@ classifiers =
|
|||||||
[options]
|
[options]
|
||||||
packages = send2trash
|
packages = send2trash
|
||||||
tests_require = pytest
|
tests_require = pytest
|
||||||
|
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
|
||||||
|
|
||||||
[options.extras_require]
|
[options.extras_require]
|
||||||
win32 = pywin32; sys_platform == "win32"
|
win32 = pywin32; sys_platform == "win32"
|
||||||
|
|||||||
@@ -144,7 +144,10 @@ def longdir(tmp_path):
|
|||||||
dirname = "\\\\?\\" + str(tmp_path)
|
dirname = "\\\\?\\" + str(tmp_path)
|
||||||
name = "A" * 100
|
name = "A" * 100
|
||||||
yield op.join(dirname, name, name, name)
|
yield op.join(dirname, name, name, name)
|
||||||
|
try:
|
||||||
shutil.rmtree(dirname, ignore_errors=True)
|
shutil.rmtree(dirname, ignore_errors=True)
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|||||||
Reference in New Issue
Block a user