4

I'd like to ask a question for which my extensive web search would suggest the answer is 'no' but maybe I've overlooked something ...

Are there Python abstraction layers sitting on top of Unix and Windows signal handling (for spawned, independent processes) and user management (getting user and group entries, comparing them, etc)?

Yes, I know that Windows and Unix differ in both aspects fundamentally but the OS specific methods do fulfill similar tasks. So it would not seem to be a bad idea to create an abstraction layer.

The closest I have found to what I'm looking for, at least for sub-process management (and to a certain degree to "signaling" those sub-processes), is python-multiprocessing, i.e. http://docs.python.org/dev/library/multiprocessing.html - it's the kind of abstraction I'm looking for but it doesn't quite do what I want.

Any pointers going in such a direction?

A module making signal handling / user management on Windows look like Unix or vice versa would also be OK.

pb2q
  • 58,613
  • 19
  • 146
  • 147
  • 3
    "signal handling" is covered by signal (+ os.kill()), subprocess modules. What use cases do you have in mind for "user managerment" (provide a code example that works on some OS and describe what it should do on another OS)? – jfs Oct 11 '12 at 18:25

1 Answers1

1

Python does already have a sort of abstraction for signal handling but on Windows your limited to:

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

User Management is a total different animal: You will have to write a wrapper yourself if you want similar handling on both platforms:

For windows look into the win32api (http://timgolden.me.uk/python/win32_how_do_i/check-a-users-credentials.html e.g.)

On Linux/Windows again theres not much for this purpose either and really depends on how authenticate (PAM locally, NIS and so on) There is libuser which is used by Debian and derivates but i have never used it myself. (http://linuxsoft.cern.ch/cern/slc6X/x86_64/yum/updates/repoview/libuser-python.html)

AlessandroEmm
  • 698
  • 7
  • 23