Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- PRIORITY = 60
- GHC_PATH = '/opt/ghc/'
- CABAL_PATH = '/opt/cabal/'
- LINK_PATH = '/usr/bin/'
- ghc_executables = [
- 'ghc',
- 'ghc-pkg',
- 'ghci',
- 'haddock',
- 'hp2ps',
- 'hpc',
- 'hsc2hs'
- 'runghc',
- 'runhaskell'
- ]
- cabal_executables = [
- 'cabal'
- ]
- def update_alternatives(path, exes, ver):
- origin_path = path + ver + '/bin/'
- command = "sudo update-alternatives --install %s %s %s %d " % \
- (LINK_PATH + exes[0], exes[0], origin_path + exes[0], PRIORITY)
- for exe in exes[1:]:
- command += "--slave %s %s %s " % (LINK_PATH + exe, exe, origin_path + exe)
- os.system(command)
- if __name__ == '__main__':
- ghc_version = raw_input("input GHC version: ")
- update_alternatives(GHC_PATH, ghc_executables, ghc_version)
- cabal_version = raw_input("input Cabal version: ")
- update_alternatives(CABAL_PATH, cabal_executables, cabal_version)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement