summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-05 05:55:43 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-05 05:55:43 +0000
commitf96f96298eb3219d029a6ead59f79993fad30e94 (patch)
tree97c7e7de3a007b1c2db161e7074c7b84235e3a29
parenta5edb98af3a01789626d3ef2af9c93eaa6f77680 (diff)
automatic import of python-pdqhashopeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-pdqhash.spec194
-rw-r--r--sources1
3 files changed, 196 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..c95e0fa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/pdqhash-0.2.3.tar.gz
diff --git a/python-pdqhash.spec b/python-pdqhash.spec
new file mode 100644
index 0000000..742a190
--- /dev/null
+++ b/python-pdqhash.spec
@@ -0,0 +1,194 @@
+%global _empty_manifest_terminate_build 0
+Name: python-pdqhash
+Version: 0.2.3
+Release: 1
+Summary: "Python bindings for Facebook's PDQ hash"
+License: MIT
+URL: https://github.com/faustomorales/pdqhash-python
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/e1/8b/7c4458eadda2a6224ea661bd835ecfe14b15f61feee2f7c2d08b06c1cdf9/pdqhash-0.2.3.tar.gz
+
+
+%description
+# pdqhash-python
+
+These are Python bindings to the PDQ perceptual hash released by Facebook. Note that the bindings are provided under the MIT license but the PDQ source code is licensed separately under its own license (see the `ThreatExchange/hashing/pdq` folder).
+
+## Installation
+
+```
+pip install pdqhash
+```
+
+## Usage
+
+```python
+import pdqhash
+
+image = cv2.imread(os.path.join('tests', 'images', image_name))
+image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
+hash_vector, quality = pdqhash.compute(image)
+
+# Get all the rotations and flips in one pass.
+# hash_vectors is a list of vectors in the following order
+# - Original
+# - Rotated 90 degrees
+# - Rotated 180 degrees
+# - Rotated 270 degrees
+# - Flipped vertically
+# - Flipped horizontally
+# - Rotated 90 degrees and flipped vertically
+# - Rotated 90 degrees and flipped horizontally
+hash_vectors, quality = pdqhash.compute_dihedral(image)
+
+# Get the floating point values of the hash.
+hash_vector_float, quality = pdqhash.compute_float(image)
+```
+
+## Contributing
+
+- Set up local development using `make init` (you need to have `pipenv` installed)
+- Run tests using `make test`
+- Run tests in Docker using `make docker_test`
+
+
+%package -n python3-pdqhash
+Summary: "Python bindings for Facebook's PDQ hash"
+Provides: python-pdqhash
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+BuildRequires: python3-cffi
+BuildRequires: gcc
+BuildRequires: gdb
+%description -n python3-pdqhash
+# pdqhash-python
+
+These are Python bindings to the PDQ perceptual hash released by Facebook. Note that the bindings are provided under the MIT license but the PDQ source code is licensed separately under its own license (see the `ThreatExchange/hashing/pdq` folder).
+
+## Installation
+
+```
+pip install pdqhash
+```
+
+## Usage
+
+```python
+import pdqhash
+
+image = cv2.imread(os.path.join('tests', 'images', image_name))
+image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
+hash_vector, quality = pdqhash.compute(image)
+
+# Get all the rotations and flips in one pass.
+# hash_vectors is a list of vectors in the following order
+# - Original
+# - Rotated 90 degrees
+# - Rotated 180 degrees
+# - Rotated 270 degrees
+# - Flipped vertically
+# - Flipped horizontally
+# - Rotated 90 degrees and flipped vertically
+# - Rotated 90 degrees and flipped horizontally
+hash_vectors, quality = pdqhash.compute_dihedral(image)
+
+# Get the floating point values of the hash.
+hash_vector_float, quality = pdqhash.compute_float(image)
+```
+
+## Contributing
+
+- Set up local development using `make init` (you need to have `pipenv` installed)
+- Run tests using `make test`
+- Run tests in Docker using `make docker_test`
+
+
+%package help
+Summary: Development documents and examples for pdqhash
+Provides: python3-pdqhash-doc
+%description help
+# pdqhash-python
+
+These are Python bindings to the PDQ perceptual hash released by Facebook. Note that the bindings are provided under the MIT license but the PDQ source code is licensed separately under its own license (see the `ThreatExchange/hashing/pdq` folder).
+
+## Installation
+
+```
+pip install pdqhash
+```
+
+## Usage
+
+```python
+import pdqhash
+
+image = cv2.imread(os.path.join('tests', 'images', image_name))
+image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
+hash_vector, quality = pdqhash.compute(image)
+
+# Get all the rotations and flips in one pass.
+# hash_vectors is a list of vectors in the following order
+# - Original
+# - Rotated 90 degrees
+# - Rotated 180 degrees
+# - Rotated 270 degrees
+# - Flipped vertically
+# - Flipped horizontally
+# - Rotated 90 degrees and flipped vertically
+# - Rotated 90 degrees and flipped horizontally
+hash_vectors, quality = pdqhash.compute_dihedral(image)
+
+# Get the floating point values of the hash.
+hash_vector_float, quality = pdqhash.compute_float(image)
+```
+
+## Contributing
+
+- Set up local development using `make init` (you need to have `pipenv` installed)
+- Run tests using `make test`
+- Run tests in Docker using `make docker_test`
+
+
+%prep
+%autosetup -n pdqhash-0.2.3
+
+%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-pdqhash -f filelist.lst
+%dir %{python3_sitearch}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.3-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..4b31bd4
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+3e69d1f97f48563ef17b08413fe582c3 pdqhash-0.2.3.tar.gz