'Undo PySide RPATH handling and add Spack RPATH.'

def patch(self):

    pypkg = self.spec['python'].package
    rpath = self.rpath
    rpath.append(os.path.join(self.prefix, pypkg.site_packages_dir, 'PySide'))
    filter_file('OPTION_CMAKE,', ('OPTION_CMAKE,    ' + ('"-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE",    "-DCMAKE_INSTALL_RPATH=%s",' % ':'.join(rpath))), 'setup.py')
    if self.spec.satisfies('@1.2.4:'):
        rpath_file = 'setup.py'
    else:
        rpath_file = 'pyside_postinstall.py'
    filter_file('(^\\s*)(rpath_cmd\\(.*\\))', '\\1#\\2', rpath_file)
    filter_file("'Programming    Language    ::    Python    ::    3.4'", "'Programming    Language    ::    Python    ::    3.4',\r\n                                'Programming    Language    ::    Python    ::    3.5'", 'setup.py')
