summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-10 17:07:52 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-10 17:07:52 +0000
commit57cdac0e3a417920107c5cc70157979051a92507 (patch)
treedde29d0104ae9e9b8810b61fea8bc59bf809327f
parent7d98f6e1dd98d1d2127f9266beb8c803f1e3b3de (diff)
automatic import of python-sanitize-filename
-rw-r--r--.gitignore1
-rw-r--r--python-sanitize-filename.spec258
-rw-r--r--sources1
3 files changed, 260 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..49c64aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/sanitize_filename-1.2.0.tar.gz
diff --git a/python-sanitize-filename.spec b/python-sanitize-filename.spec
new file mode 100644
index 0000000..6c6bb67
--- /dev/null
+++ b/python-sanitize-filename.spec
@@ -0,0 +1,258 @@
+%global _empty_manifest_terminate_build 0
+Name: python-sanitize-filename
+Version: 1.2.0
+Release: 1
+Summary: A permissive filename sanitizer.
+License: MIT License
+URL: https://gitlab.com/jplusplus/sanitize-filename
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/a3/1c/2757fe1d119304407c501236de0fa7482975f4fbef3d955abc3f7d88c986/sanitize_filename-1.2.0.tar.gz
+BuildArch: noarch
+
+
+%description
+A simple, dependency-free, blacklist-based filename sanitizer, for when you want to keep the original filename.
+
+Note that a blacklist based sanitizer will _never_ be as safe as a whitelist based one. In most cases, your best option is to create a safe filename yourself. Your second safest option is to use a whitelist approach (allowing only certain characters). This sanitizer is useful when you want to keep the original filename, including non ascii characters, whenever possible.
+
+## Installation
+
+```sh
+pip install sanitize_filename
+```
+
+## Usage
+
+```python3
+from sanitize_filename import sanitize
+
+
+filename = input("Enter a file name:")
+filename = sanitize(filename)
+```
+
+Examples:
+
+```python3
+> sanitize("A/B/C.txt")
+'ABC.txt'
+
+> sanitize("this𓀦filenameḜisあactually...valid.txt")
+'this𓀦filenameḜisあactually...valid.txt'
+
+> sanitize("def.")
+'def'
+
+> sanitize("NUL")
+'__NUL'
+
+> sanitize("..")
+'__'
+```
+
+## Changelog
+
+- 1.2.0
+
+ - Get rid of os dependent checks; ensure uniform behaviour
+ - Now works on long filenames where the non-extensions part consists of only dots
+
+- 1.1.0
+
+ - Try to preserve filename extensions if possible
+
+- 1.0.1
+
+ - First release (as 1.0.1 due to a version number mix-up in 1.0.0)
+
+- 1.0.0-dev3
+
+ - Black list low code point characters (<32)
+
+- 1.0.0-dev1
+
+ - First version
+
+
+
+%package -n python3-sanitize-filename
+Summary: A permissive filename sanitizer.
+Provides: python-sanitize-filename
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-sanitize-filename
+A simple, dependency-free, blacklist-based filename sanitizer, for when you want to keep the original filename.
+
+Note that a blacklist based sanitizer will _never_ be as safe as a whitelist based one. In most cases, your best option is to create a safe filename yourself. Your second safest option is to use a whitelist approach (allowing only certain characters). This sanitizer is useful when you want to keep the original filename, including non ascii characters, whenever possible.
+
+## Installation
+
+```sh
+pip install sanitize_filename
+```
+
+## Usage
+
+```python3
+from sanitize_filename import sanitize
+
+
+filename = input("Enter a file name:")
+filename = sanitize(filename)
+```
+
+Examples:
+
+```python3
+> sanitize("A/B/C.txt")
+'ABC.txt'
+
+> sanitize("this𓀦filenameḜisあactually...valid.txt")
+'this𓀦filenameḜisあactually...valid.txt'
+
+> sanitize("def.")
+'def'
+
+> sanitize("NUL")
+'__NUL'
+
+> sanitize("..")
+'__'
+```
+
+## Changelog
+
+- 1.2.0
+
+ - Get rid of os dependent checks; ensure uniform behaviour
+ - Now works on long filenames where the non-extensions part consists of only dots
+
+- 1.1.0
+
+ - Try to preserve filename extensions if possible
+
+- 1.0.1
+
+ - First release (as 1.0.1 due to a version number mix-up in 1.0.0)
+
+- 1.0.0-dev3
+
+ - Black list low code point characters (<32)
+
+- 1.0.0-dev1
+
+ - First version
+
+
+
+%package help
+Summary: Development documents and examples for sanitize-filename
+Provides: python3-sanitize-filename-doc
+%description help
+A simple, dependency-free, blacklist-based filename sanitizer, for when you want to keep the original filename.
+
+Note that a blacklist based sanitizer will _never_ be as safe as a whitelist based one. In most cases, your best option is to create a safe filename yourself. Your second safest option is to use a whitelist approach (allowing only certain characters). This sanitizer is useful when you want to keep the original filename, including non ascii characters, whenever possible.
+
+## Installation
+
+```sh
+pip install sanitize_filename
+```
+
+## Usage
+
+```python3
+from sanitize_filename import sanitize
+
+
+filename = input("Enter a file name:")
+filename = sanitize(filename)
+```
+
+Examples:
+
+```python3
+> sanitize("A/B/C.txt")
+'ABC.txt'
+
+> sanitize("this𓀦filenameḜisあactually...valid.txt")
+'this𓀦filenameḜisあactually...valid.txt'
+
+> sanitize("def.")
+'def'
+
+> sanitize("NUL")
+'__NUL'
+
+> sanitize("..")
+'__'
+```
+
+## Changelog
+
+- 1.2.0
+
+ - Get rid of os dependent checks; ensure uniform behaviour
+ - Now works on long filenames where the non-extensions part consists of only dots
+
+- 1.1.0
+
+ - Try to preserve filename extensions if possible
+
+- 1.0.1
+
+ - First release (as 1.0.1 due to a version number mix-up in 1.0.0)
+
+- 1.0.0-dev3
+
+ - Black list low code point characters (<32)
+
+- 1.0.0-dev1
+
+ - First version
+
+
+
+%prep
+%autosetup -n sanitize-filename-1.2.0
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-sanitize-filename -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 1.2.0-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..da24a9b
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+bc54beef1ac1c73e8f4bb01069c1dc66 sanitize_filename-1.2.0.tar.gz