Skip to content

Commit b52ec0f

Browse files
authored
Merge pull request #904 from dthelegend/beta
Remove use of Environment Python
2 parents 7bb7711 + 5720faa commit b52ec0f

File tree

11 files changed

+14
-13
lines changed

11 files changed

+14
-13
lines changed

howdy-gtk/bin/howdy-gtk.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22

3-
env python3 "@script_path@" "$@"
3+
@python_path@ "@script_path@" "$@"

howdy-gtk/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ interface_files = files(
6565
install_data(interface_files, install_dir: datadir)
6666

6767
cli_path = join_paths(pysourcesinstalldir, 'init.py')
68-
conf_data = configuration_data({ 'script_path': cli_path })
68+
conf_data = configuration_data({ 'script_path': cli_path, 'python_path': py.full_path() })
6969

7070
bin_name = 'howdy-gtk'
7171
bin = configure_file(

howdy-gtk/src/init.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python3
21
# Opens auth ui if requested, otherwise starts normal ui
32
import sys
43

howdy/src/bin/howdy.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22

3-
env python3 "@script_path@" "$@"
3+
@python_path@ "@script_path@" "$@"

howdy/src/cli.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python3
21
# CLI directly called by running the howdy command
32

43
# Import required modules

howdy/src/compare.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python3
21
# Compare incoming video with known faces
32
# Running in a local python instance to get around PATH issues
43

howdy/src/meson.build

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ if meson.is_subproject()
22
project('howdy', 'cpp', license: 'MIT', version: 'beta', meson_version: '>= 0.64.0')
33
endif
44

5-
py = import('python').find_installation()
6-
py.dependency()
75

86
datadir = get_option('prefix') / get_option('datadir') / 'howdy'
97
py_conf = configuration_data(paths_dict)
108
py_conf.set('data_dir', datadir)
119

10+
py = import('python').find_installation(paths_dict.get('python_path'))
11+
py.dependency()
12+
1213
py_paths = configure_file(
1314
input: 'paths.py.in',
1415
output: 'paths.py',
@@ -153,7 +154,7 @@ install_man('../howdy.1')
153154
# endif
154155

155156
cli_path = join_paths(pysourcesinstalldir, 'cli.py')
156-
conf_data = configuration_data({ 'script_path': cli_path })
157+
conf_data = configuration_data({ 'script_path': cli_path, 'python_path': py.full_path() })
157158

158159
bin_name = 'howdy'
159160
bin = configure_file(

howdy/src/pam/main.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
const auto DEFAULT_TIMEOUT =
4848
std::chrono::duration<int, std::chrono::milliseconds::period>(100);
4949
const auto MAX_RETRIES = 5;
50-
const auto PYTHON_EXECUTABLE = "python3";
5150

5251
#define S(msg) gettext(msg)
5352

@@ -268,12 +267,12 @@ auto identify(pam_handle_t *pamh, int flags, int argc, const char **argv,
268267
}
269268
}
270269

271-
const char *const args[] = {PYTHON_EXECUTABLE, // NOLINT
270+
const char *const args[] = {PYTHON_EXECUTABLE_PATH, // NOLINT
272271
COMPARE_PROCESS_PATH, username, nullptr};
273272
pid_t child_pid;
274273

275274
// Start the python subprocess
276-
if (posix_spawnp(&child_pid, PYTHON_EXECUTABLE, nullptr, nullptr,
275+
if (posix_spawnp(&child_pid, PYTHON_EXECUTABLE_PATH, nullptr, nullptr,
277276
const_cast<char *const *>(args), nullptr) != 0) {
278277
syslog(LOG_ERR, "Can't spawn the howdy process: %s (%d)", strerror(errno),
279278
errno);

howdy/src/pam/paths.hh.in

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
const auto COMPARE_PROCESS_PATH = "@compare_script_path@";
22
const auto CONFIG_FILE_PATH = "@config_file_path@";
3-
const auto USER_MODELS_DIR = "@user_models_dir@";
3+
const auto USER_MODELS_DIR = "@user_models_dir@";
4+
const auto PYTHON_EXECUTABLE_PATH = "@python_path@";

meson.build

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ dlibdatadir = get_option('dlib_data_dir') != '' ? get_option('dlib_data_dir') :
44
confdir = get_option('config_dir') != '' ? get_option('config_dir') : join_paths(get_option('prefix'), get_option('sysconfdir'), 'howdy')
55
usermodelsdir = get_option('user_models_dir') != '' ? get_option('user_models_dir') : join_paths(confdir, 'models')
66
logpath = get_option('log_path')
7+
pythonpath = get_option('python_path')
78

89
config_path = join_paths(confdir, 'config.ini')
910

@@ -12,6 +13,7 @@ paths_dict = {
1213
'dlib_data_dir': dlibdatadir,
1314
'user_models_dir': usermodelsdir,
1415
'log_path': logpath,
16+
'python_path': pythonpath
1517
}
1618

1719
# We need to keep this order beause howdy-gtk defines the gtk script path which is used later in howdy

meson.options

+1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ option('user_models_dir', type: 'string', value: '', description: 'Set the user
66
option('log_path', type: 'string', value: '/var/log/howdy', description: 'Set the log file path')
77
option('install_in_site_packages', type: 'boolean', value: false, description: 'Install howdy python files in site packages')
88
option('py_sources_dir', type: 'string', value: '', description: 'Set the python sources directory')
9+
option('python_path', type: 'string', value: '/usr/bin/python', description: 'Set the path to the python executable')
910
option('install_pam_config', type: 'boolean', value: false, description: 'Install pam config file (for Debian/Ubuntu)')

0 commit comments

Comments
 (0)