Skip to content

Commit 55baf65

Browse files
committed
🐍 Wraps CLI execution within main function to appease setuptools
1 parent 33b01cb commit 55baf65

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
setup(
1212
name = "watch_path",
13-
version = "0.0.7",
13+
version = "0.0.8",
1414
author = "S0AndS0",
1515
author_email = "StrangerThanBland@gmail.com",
1616
description = "Simple wrapper for `os.stat`, calls callback function time-stamp changes",
@@ -20,7 +20,7 @@
2020
packages = find_packages(),
2121
entry_points = {
2222
'console_scripts': [
23-
'watch_path = watch_path.cli'
23+
'watch_path = watch_path.cli:main'
2424
],
2525
},
2626
classifiers = [

watch_path/cli/__init__.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,23 @@ def subprocess_callback(**kwargs):
9191
decode = args.get('decode')
9292

9393

94-
try:
95-
for callback_results in path_watcher:
96-
if callback_results:
97-
if args.get('verbose') > 0:
98-
print("callback_results['returncode'] ->", callback_results['returncode'])
99-
print("callback_results['stdout']...")
100-
101-
if decode:
102-
print(callback_results['stdout'].decode(decode))
103-
else:
104-
print(callback_results['stdout'])
105-
106-
sleep(args.get('sleep', 1.0))
107-
108-
except KeyboardInterrupt:
109-
print('Stopping watcher and exiting...')
94+
def main(args):
95+
try:
96+
for callback_results in path_watcher:
97+
if callback_results:
98+
if args.get('verbose') > 0:
99+
print("callback_results['returncode'] ->", callback_results['returncode'])
100+
print("callback_results['stdout']...")
101+
102+
if decode:
103+
print(callback_results['stdout'].decode(decode))
104+
else:
105+
print(callback_results['stdout'])
106+
107+
sleep(args.get('sleep', 1.0))
108+
109+
except KeyboardInterrupt:
110+
print('Stopping watcher and exiting...')
111+
112+
113+
main(args)

0 commit comments

Comments
 (0)