Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 79 lines (75 sloc) 1.79 KB
#!/usr/bin/python
print "Finding installed package managers"
print "----------------------------------"
print
# which NAME|grep "NAME not found"
# if blank, then NAME installed
# show version?
# array of pm name, executable
# iterate the array
# show installed, not installed
pmlist = [
["Dpkg","dpkg"],
["NPM","npm"],
["Conan","conan"],
["CPAN","cpan"],
["Pip","pip"],
["Gradle","gradle"],
["LuaRocks","luarocks"],
["Maven","mvn"],
["Nuget","nuget"],
["Pyrus","pyrus"],
["Ruby Gems","gem"],
["Scala SBT","sbt"],
["OCAML OPAM","opam"],
["Yarn","yarn"],
["Rust Cargo","cargo"],
["Bower","bower"],
["LilyPond lyp","lyp"],
["Composer","composer"],
["CocoaPods","pod"],
["Haskell Cabal","cabal"],
["Anaconda","conda"],
["PackageKit","pkcon"],
["Yum","yum"],
["ZeroInstall","0install"],
["PkgSrc","pkg_add"],
["MacPorts","port"],
["Portage","emerge"],
["Homebrew","brew"],
["Fink","fink"],
["Arch Linux","pacman"],
["APT","apt-get"],
["SWareT","swaret"],
["Snappy","snapd"],
["Slapt-get","slapt-get"],
["Slackpkg","slackpkg"],
["RPM","rpm"],
["OPKG","opkg"],
["GNU Guix","guix"]
]
import subprocess
installed = []
notinstalled = []
for pm in pmlist:
p = subprocess.Popen(['which',pm[1]], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
result = pm[0]+":"
result = result.ljust(20)
output = p.stdout.readlines()
if output == []:
result += "Not installed"
notinstalled.append(result)
else:
result += output[0]
installed.append(result)
installed.sort()
notinstalled.sort()
print "INSTALLED"
print
for line in installed:
print line,
print
print "NOT INSTALLED"
print
for line in notinstalled:
print line