summaryrefslogtreecommitdiff
path: root/devel/pyinstaller/files/patch-PyInstaller_build.py
blob: afcd664062d63dd2ae49aaf7af1031fc1b663b0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--- PyInstaller/build.py.orig	2013-09-15 20:27:11 UTC
+++ PyInstaller/build.py
@@ -1411,8 +1411,17 @@ class COLLECT(Target):
                                  upx=(self.upx_binaries and (is_win or is_cygwin)), 
                                  dist_nm=inm)
             if typ != 'DEPENDENCY':
-                shutil.copy2(fnm, tofnm)
-            if typ in ('EXTENSION', 'BINARY'):
+                def copy_noschg(src, dst):
+                    """ copy access/modification times and user flags only to
+                        allow operation under regular user e.g. on FreeBSD,
+                        where /lib/libc.so.* by default has stat.SF_IMMUTABLE
+                        flag set (which is super-user only)"""
+                    shutil.copyfile(src, dst)
+                    sb = os.stat(src)
+                    os.utime(dst, (sb.st_atime, sb.st_mtime))
+                    os.chflags(dst, sb.st_flags & 0x0000ffff)	# UF_SETTABLE
+                copy_noschg(fnm, tofnm)
+            if typ in ('EXTENSION', 'BINARY', 'EXECUTABLE'):
                 os.chmod(tofnm, 0755)
         _save_data(self.out,
                  (self.name, self.strip_binaries, self.upx_binaries, self.toc))