File tree 4 files changed +19
-18
lines changed
4 files changed +19
-18
lines changed Original file line number Diff line number Diff line change 4
4
"""
5
5
import os
6
6
import sys
7
- import argparse
8
7
from pathlib import Path
9
8
from itertools import cycle
10
9
from collections import deque
34
33
'The screensaver is inactive' )
35
34
36
35
37
- def main ():
38
- parser = argparse .ArgumentParser ()
39
- parser .add_argument (
40
- '-a' , '--address' ,
41
- required = True ,
42
- help = 'Your phone or another bluetooth device MAC Address' )
43
- options = parser .parse_args ()
44
- return bluetooth_distance_locker (options .address )
45
-
46
-
47
36
def bluetooth_distance_locker (device_mac_address ):
48
37
commend = [str (SENSOR_SCRIPT_PATH ), device_mac_address ]
49
38
queue = deque (maxlen = 5 )
@@ -100,7 +89,3 @@ def check_screen_save_status():
100
89
state = UNLOCK_STATE
101
90
run (LOCKER_UNLOCK_COMMAND .split ())
102
91
print_state ()
103
-
104
-
105
- if __name__ == '__main__' :
106
- sys .exit (main ())
Original file line number Diff line number Diff line change
1
+ import sys
2
+ import argparse
3
+ from distance_locker import bluetooth_distance_locker
4
+
5
+
6
+ def main ():
7
+ parser = argparse .ArgumentParser ()
8
+ parser .add_argument (
9
+ '-a' , '--address' ,
10
+ required = True ,
11
+ help = 'Your phone or another bluetooth device MAC Address' )
12
+ options = parser .parse_args ()
13
+ return bluetooth_distance_locker (options .address )
14
+
15
+ if __name__ == '__main__' :
16
+ sys .exit (main ())
File renamed without changes.
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
2
from distutils .core import setup
3
+ from setuptools import find_packages
3
4
4
5
setup (
5
6
name = 'distance_locker' ,
6
7
version = '0.0.1' ,
7
8
url = 'https://github.com/liormizr/linux_distance_locker' ,
8
9
author = 'Lior Mizrahi' ,
9
10
author_email = 'li.mizr@gmail.com' ,
10
- py_modules = ['distance_locker' ],
11
- scripts = ['bluetooth_distance_sensor.sh' ],
11
+ packages = find_packages (),
12
12
entry_points = {
13
13
'console_scripts' : [
14
- 'distance_locker = distance_locker:main' ,
14
+ 'distance_locker = distance_locker.__main__ :main' ,
15
15
]},
16
16
)
You can’t perform that action at this time.
0 commit comments