Python Unix / Windows Abstraction Layer for Signal Processing and User Management

I would like to ask a question for which my extensive web search suggests that the answer is no, but maybe I missed something ...

Are there levels of Python abstraction on top of Unix and Windows signal processing (for unresolved independent processes) and user management (getting user and group entries, comparing them, etc.)?

Yes, I know that Windows and Unix are significantly different from each other in both aspects, but OS-specific methods perform similar tasks. Thus, it would be nice to create an abstraction layer.

The closest I found to what I'm looking for, at least to control the subprocess (and to some extent to โ€œsignalโ€ these subprocesses), is python multiprocessing, i.e. http://docs.python.org/dev /library/multiprocessing.html is the abstraction I am looking for, but it doesnโ€™t quite do what I want.

Any pointers going in that direction?

The module that controls signal processing / user management in Windows looks like Unix or vice versa, it will also be ok.

+4
source share
1 answer

Python already has some kind of abstraction for signal processing, but on Windows yours is limited to:

signal () can only be called with SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV or SIGTERM. ValueError will be raised in any other case.

User management is a common different animal: you will need to write a wrapper yourself if you want to use similar processing on both platforms:

For windows, see win32api ( http://timgolden.me.uk/python/win32_how_do_i/check-a-users-credentials.html , for example.)

On Linux / Windows, there is again not too much for this purpose and really depends on how to authenticate (PAM locally, NIS, etc.) There is a libuser that is used by Debian and its derivatives, but I never used it myself. ( http://linuxsoft.cern.ch/cern/slc6X/x86_64/yum/updates/repoview/libuser-python.html )

+1
source

Source: https://habr.com/ru/post/1439227/


All Articles