-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
80 lines (63 loc) · 2.09 KB
/
setup.py
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
from setuptools import find_packages
from setuptools import setup
from urllib import request
import bz2
import os
import sys
__version__ = "0.2.0"
def shape_predictor() -> str:
"""Donwload and return dlib Predictor Weights File Path"""
# Define Bases for path and url
base = "http://dlib.net/files"
root = os.path.join("facetool", "model")
# Define file names
bz2_file = "shape_predictor_68_face_landmarks.dat.bz2"
dat_file = "shape_predictor_68_face_landmarks.dat"
# Define file paths and url
url = f"{base}/{bz2_file}"
bz2_path = f"{root}/{bz2_file}"
dat_path = f"{root}/{dat_file}"
if not os.path.isfile(dat_path):
os.makedirs(root, exist_ok=True)
# Read Compressed file
request.urlretrieve(url, bz2_path)
with open(bz2_path, "rb") as fh:
compressed = fh.read()
decompressed = bz2.decompress(compressed)
os.remove(bz2_path)
# Write Uncompressed file
with open(dat_path, "wb") as fh:
fh.write(decompressed)
return dat_path
dat_file = shape_predictor()
masknet = os.path.join("facetool", "model", "masknet.pt")
desciption = (
f"FaceTool: a Tool for Single Face Videos"
)
with open('requirements.txt') as fh:
requirements = fh.read().splitlines()
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="facetool",
version=__version__,
author="Yliess HATI",
author_email="hatiyliess86@gmail.com",
description=desciption,
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/yliess86/FaceTool",
python_requires=">=3.6",
install_requires=requirements,
packages=find_packages(),
include_package_data=True,
data_files=[
(os.path.join(sys.prefix, "facetool", "model"), [dat_file]),
(os.path.join(sys.prefix, "facetool", "model"), [masknet])
],
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
)