dvrip icon indicating copy to clipboard operation
dvrip copied to clipboard

Entry points should work with python -m

Open pfalcon opened this issue 4 years ago • 1 comments

I'm not sure if I find empathy here, but my system is not made of rubber. If I'll install all the things I try (even in virtualenv), it will be a mess. That's pretty much why I use Python - that I can clone, review code, run, and hack on it, all without extra unneeded motions.

Let's try it here:

$ python3.7 -m dvrip.cmd
/usr/bin/python3.7: No module named dvrip.cmd.__main__; 'dvrip.cmd' is a package and cannot be directly executed

Oops. Following an observation in https://github.com/alexshpilkin/dvrip/issues/5, looks like some contrast with depending on features which aren't available in default Python installed in many distro nowadays (3.5-3.6), and not having old good (by now) __main__.py.

Following patch allows to proceed further:

diff --git a/dvrip/cmd/__main__.py b/dvrip/cmd/__main__.py
new file mode 100644
index 0000000..e7d3e76
--- /dev/null
+++ b/dvrip/cmd/__main__.py
@@ -0,0 +1,4 @@
+from . import main
+
+
+main()

pfalcon avatar Oct 25 '19 17:10 pfalcon

Following patch allows to proceed further:

A bit further I mean. Because when using code like below to execute code in submodules of current package, you can't proceed too far:

	name = 'dvr-' + command
	try:
		execvp(name, [name] + args)
	except OSError as e:
		osexit(e)

pfalcon avatar Oct 25 '19 17:10 pfalcon