Q:

Understanding Package Management Systems

I am attempting to understand what a Package Management System. I grasp the main concept of it but I have some queries. 

Does a package management system install features(compilers, libraries, virtual machines) necessary to run an application AND install an application or does it just install features necessary to run an application?  
Are package management systems external applications that you run with command line arguments or are they API libraries that you integrate into your installer code?

To use an example; if my application uses python 2.7 and wxPython would a Package Management System ensure that python 2.7 is installed and wxPython is installed then finally install my application(python script files)?

A:

Package management systems and installers (the latter found on windows systems) can and should ensure that the whole working environment, especially libraries and the program itself are installed on a system. This normally includes all direct dependencies, but not things like compilers or linkers that are only required during development. There are source packages meant to be build on the target system in this case it may sometimes check if certain things are available, but normally would not install them. You normally will get error messages or warning during the build process.
So if possible the package will directly install everything necessary to run a program (If you run a package manager on Linux you quite often get info like "15 additional packages need to be installed. Continue?" These additional packages are libraries and other dependencies). When creating your packages you can define any kind of dependency you like, you are not limited to libraries but could have packages for graphics or documentation or any other resource you may choose to keep independent from the program itself.
There are command line tools like apt-get (the tool used for package management on Debian based systems), but there are also GUI programs to run those tasks (but those often only provide a GUI and actually call the cl tools). But those cl tools itself are using functions from some library which in theory you could include in any program you like.
So package managers behave somewhat similar to installers. The main difference is that a pm is part of the operating system and keep information about installed packages in a central place. You will find installers more likely on windows and they behave slightly more independent and are programs of their own (using system functionality too, like the registry). Installers are rather uncommon on Linux systems but nothing would prevent you from writing one if your software would need it and base it on the libraries used on your target system to ensure integrity with the package management.

