forked from hhj1897/face_alignment
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
56 lines (50 loc) · 1.83 KB
/
setup.py
File metadata and controls
56 lines (50 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import subprocess
import sys
import shutil
from setuptools import find_namespace_packages, setup
def clean_repo():
repo_folder = os.path.realpath(os.path.dirname(__file__))
dist_folder = os.path.join(repo_folder, 'dist')
build_folder = os.path.join(repo_folder, 'build')
if os.path.isdir(dist_folder):
shutil.rmtree(dist_folder, ignore_errors=True)
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
script_folder = os.path.realpath(os.path.dirname(__file__))
with open(os.path.join(script_folder, 'ibug', 'face_alignment', '__init__.py')) as init:
for line in init.read().splitlines():
fields = line.replace('=', ' ').replace('\'', ' ').replace('\"', ' ').replace('\t', ' ').split()
if len(fields) >= 2 and fields[0] == '__version__':
_version = fields[1]
break
if _version is None:
sys.exit('Sorry, cannot find version information.')
# Installation
config = {
'name': 'ibug_face_alignment',
'version': _version,
'description': 'Facial landmark detection using stack hourglass networks.',
'author': 'Jie Shen',
'author_email': 'js1907@imperial.ac.uk',
'packages': find_namespace_packages(),
'package_data': {'ibug.face_alignment.fan.weights': ['*.pth']},
'install_requires': ['numpy>=1.16.0', 'torch>=1.1.0', 'opencv-python>=3.4.2'],
'zip_safe': False
}
clean_repo()
setup(**config)
clean_repo()