Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
Try to workaround Windows read-only bug
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickMassot committed May 25, 2020
1 parent 1547db5 commit 6e06675
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mathlibtools/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import re
import os
import stat
import platform
import subprocess
from datetime import datetime
from typing import Iterable, Union, List, Tuple, Optional
Expand Down Expand Up @@ -588,6 +589,11 @@ def upgrade_mathlib(self) -> None:
return
self.rev = self.repo.commit().hexsha
else:
# Try to work around a Windows bug
if platform.system() == 'Windows':
pack = self.mathlib_folder/'.git'/'objects'/'pack'
for path in pack.glob('*.idx'):
os.chmod(str(path), stat.S_IWRITE)
try:
shutil.rmtree(str(self.mathlib_folder))
except FileNotFoundError:
Expand Down

0 comments on commit 6e06675

Please sign in to comment.