From ff9e5b50094e82ca42232715d41e130d952f5ceb Mon Sep 17 00:00:00 2001 From: Anja Date: Mon, 9 Oct 2023 18:42:24 +0300 Subject: [PATCH 1/3] Automatically discover submodules in setup.py and include package data too. --- setup.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 67bdfe2..6242691 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import os import sys import shutil -from setuptools import setup +from setuptools import find_namespace_packages, setup def clean_repo(): @@ -33,7 +33,12 @@ def clean_repo(): 'description': 'A collection of pretrained face detectors including S3FD and RetinaFace.', 'author': 'Jie Shen', 'author_email': 'js1907@imperial.ac.uk', - 'packages': ['ibug.face_detection'], + 'packages': find_namespace_packages(), + 'package_data': { + 'ibug.face_detection.s3fd.weights': ['*.pth'], + 'ibug.face_detection.retina_face.weights': ['*.pth'], + 'ibug.face_detection.utils.data': ['*.npy'], + }, 'install_requires': ['numpy>=1.16.0', 'scipy>=1.1.0', 'torch>=1.1.0', 'torchvision>=0.3.0', 'opencv-python>= 3.4.2'], 'zip_safe': False From ba652026270bc3aede3909abf7a61c46366d7344 Mon Sep 17 00:00:00 2001 From: Anja Date: Mon, 9 Oct 2023 19:56:21 +0300 Subject: [PATCH 2/3] Ensure setup.py pulls git LFS files before install. Based on this: https://stackoverflow.com/a/58932741 --- setup.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/setup.py b/setup.py index 6242691..baf3c65 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ import os +import subprocess import sys import shutil from setuptools import find_namespace_packages, setup @@ -13,6 +14,18 @@ def clean_repo(): if os.path.isdir(build_folder): shutil.rmtree(build_folder, ignore_errors=True) +def pull_first(): + """This script is in a git directory that can be pulled.""" + cwd = os.getcwd() + gitdir = os.path.dirname(os.path.realpath(__file__)) + os.chdir(gitdir) + try: + subprocess.call(['git', 'lfs', 'pull']) + except subprocess.CalledProcessError: + raise RuntimeError("Make sure git-lfs is installed!") + os.chdir(cwd) + +pull_first() # Read version string _version = None From 19277cca6daf28bbc6d7b29334af334acb8bc661 Mon Sep 17 00:00:00 2001 From: Anja Date: Mon, 9 Oct 2023 19:58:04 +0300 Subject: [PATCH 3/3] Small typo in requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a5894c9..79672fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ numpy>=1.16.0 scipy>=1.1.0 torch>=1.1.0 torchvision>=0.3.0 -opencv-python>= 3.4.2 +opencv-python>=3.4.2