aco: don't fix break condition for break+discard to exec
[mesa.git] / bin / install_megadrivers.py
old mode 100755 (executable)
new mode 100644 (file)
index 551e385..0a28dd7
@@ -1,6 +1,6 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # encoding=utf-8
-# Copyright © 2017-2018 Intel Corporation
+# Copyright 2017-2018 Intel Corporation
 
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -25,7 +25,6 @@
 from __future__ import print_function
 import argparse
 import os
-import shutil
 
 
 def main():
@@ -36,7 +35,11 @@ def main():
     args = parser.parse_args()
 
     if os.path.isabs(args.libdir):
-        to = os.path.join(os.environ.get('DESTDIR', '/'), args.libdir[1:])
+        destdir = os.environ.get('DESTDIR')
+        if destdir:
+            to = os.path.join(destdir, args.libdir[1:])
+        else:
+            to = args.libdir
     else:
         to = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], args.libdir)
 
@@ -46,7 +49,6 @@ def main():
         if os.path.lexists(to):
             os.unlink(to)
         os.makedirs(to)
-    shutil.copy(args.megadriver, master)
 
     for driver in args.drivers:
         abs_driver = os.path.join(to, driver)
@@ -68,7 +70,14 @@ def main():
                 name, ext = os.path.splitext(name)
         finally:
             os.chdir(ret)
+
+    # Remove meson-created master .so and symlinks
     os.unlink(master)
+    name, ext = os.path.splitext(master)
+    while ext != '.so':
+        if os.path.lexists(name):
+            os.unlink(name)
+        name, ext = os.path.splitext(name)
 
 
 if __name__ == '__main__':