achadwick / styrene

A repacking tool that creates usable app bundles for regular Windows users out of MSYS2 binary packages.
GNU General Public License v3.0
40 stars 11 forks source link

Building to temp directory fails because of permissions #14

Closed craigminihan closed 7 years ago

craigminihan commented 7 years ago

The build process fails when cleaning up the temporary directory if contained files do not have write permissions.

This can be seen by building gedit.cfg under msys 20161025 which fails when removing fakepq.h which only has permissions r--r--r--.

achadwick commented 7 years ago

Fuller exception from some recent testing of mine. Looks like pain shutil.rmtree() isn't enough, and we might have to do a pass through to force write permissions on files (on POSIX, write permission to the directory would be enough, sigh).

Traceback (most recent call last):
  File "C:/msys32/mingw64/lib/python3.5/site-packages\styrene\cmdline.py", line 252, in main
    process_spec_file(spec, options)
  File "C:/msys32/mingw64/lib/python3.5/site-packages\styrene\cmdline.py", line 130, in process_spec_file
    shutil.copy(distfile, distfile_final)
  File "C:/msys32/mingw64/lib/python3.5\tempfile.py", line 808, in __exit__
    self.cleanup()
  File "C:/msys32/mingw64/lib/python3.5\tempfile.py", line 812, in cleanup
    _shutil.rmtree(self.name)
  File "C:/msys32/mingw64/lib/python3.5\shutil.py", line 494, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:/msys32/mingw64/lib/python3.5\shutil.py", line 384, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:/msys32/mingw64/lib/python3.5\shutil.py", line 384, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:/msys32/mingw64/lib/python3.5\shutil.py", line 384, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:/msys32/mingw64/lib/python3.5\shutil.py", line 384, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:/msys32/mingw64/lib/python3.5\shutil.py", line 384, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:/msys32/mingw64/lib/python3.5\shutil.py", line 389, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:/msys32/mingw64/lib/python3.5\shutil.py", line 387, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:/msys32/tmp/tmpeeg145rw/mypaint-git-w64/mingw64/lib/python2.7/config/libpython2.7.dll.a'