-
-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: provide a seperate python3-dlib dependency package on debian #814
base: beta
Are you sure you want to change the base?
Changes from all commits
d3c130a
f52674a
175ed8f
7429dc4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,83 +106,6 @@ if "upgrade" in sys.argv: | |
|
||
sys.exit(0) | ||
|
||
log("Downloading dlib") | ||
|
||
dlib_archive = "/tmp/v19.16.tar.gz" | ||
loader = which("wget") | ||
LOADER_CMD = None | ||
|
||
# If wget is installed, use that as the downloader | ||
if loader: | ||
LOADER_CMD = [loader, "--tries", "5", "--output-document"] | ||
# Otherwise, fall back on curl | ||
else: | ||
loader = which("curl") | ||
LOADER_CMD = [loader, "--retry", "5", "--location", "--output"] | ||
|
||
# Assemble and execute the download command | ||
cmd = LOADER_CMD + [dlib_archive, "https://github.com/davisking/dlib/archive/v19.16.tar.gz"] | ||
handleStatus(sc(cmd)) | ||
|
||
# The folder containing the dlib source | ||
DLIB_DIR = None | ||
# A regex of all files to ignore while unpacking the archive | ||
excludes = re.compile( | ||
"davisking-dlib-\w+/(dlib/(http_client|java|matlab|test/)|" | ||
"(docs|examples|python_examples)|" | ||
"tools/(archive|convert_dlib_nets_to_caffe|htmlify|imglab|python/test|visual_studio_natvis))" | ||
) | ||
|
||
# Open the archive | ||
with tarfile.open(dlib_archive) as tf: | ||
for item in tf: | ||
# Set the destenation dir if unset | ||
if not DLIB_DIR: | ||
DLIB_DIR = "/tmp/" + item.name | ||
|
||
# extract only files sufficient for building | ||
if not excludes.match(item.name): | ||
tf.extract(item, "/tmp") | ||
|
||
# Delete the downloaded archive | ||
os.unlink(dlib_archive) | ||
|
||
log("Building dlib") | ||
|
||
cmd = ["sudo", "python3", "setup.py", "install"] | ||
cuda_used = False | ||
|
||
# Compile and link dlib | ||
try: | ||
sp = subprocess.Popen(cmd, cwd=DLIB_DIR, stdout=subprocess.PIPE) | ||
except subprocess.CalledProcessError: | ||
print("Error while building dlib") | ||
raise | ||
|
||
# Go through each line from stdout | ||
while sp.poll() is None: | ||
line = sp.stdout.readline().decode("utf-8") | ||
|
||
if "DLIB WILL USE CUDA" in line: | ||
cuda_used = True | ||
|
||
print(line, end="") | ||
|
||
log("Cleaning up dlib") | ||
|
||
# Remove the no longer needed git clone | ||
del sp | ||
rmtree(DLIB_DIR) | ||
|
||
print("Temporary dlib files removed") | ||
|
||
log("Configuring howdy") | ||
|
||
# Manually change the camera id to the one picked | ||
for line in fileinput.input(["/etc/howdy/config.ini"], inplace=1): | ||
line = line.replace("use_cnn = false", "use_cnn = " + str(cuda_used).lower()) | ||
print(line, end="") | ||
|
||
Comment on lines
-179
to
-185
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you remove these lines? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CNN depends on CUDA, and |
||
print("Camera ID saved") | ||
|
||
# Secure the howdy folder | ||
|
@@ -196,6 +119,8 @@ handleStatus(sc(["chmod 755 -R /lib/security/howdy/cli"], shell=True)) | |
print("Permissions set") | ||
|
||
# Make the CLI executable as howdy | ||
if os.path.exists("/usr/local/bin/howdy"): | ||
os.unlink("/usr/local/bin/howdy") | ||
os.symlink("/lib/security/howdy/cli.py", "/usr/local/bin/howdy") | ||
os.chmod("/usr/local/bin/howdy", 0o755) | ||
print("Howdy command installed") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that
python3-dlib
was not used because it crashed a LOT for a ton of people in the early days. Is it stable now?