Browse Source

Resolved an issue with incorrect permissions when installing again through setup.py

tags/v1.6.0
liuluobin 3 years ago
parent
commit
d50178f1f8
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      setup.py

+ 13
- 0
setup.py View File

@@ -14,6 +14,7 @@
import os
import stat
import shlex
import shutil
import subprocess
from setuptools import find_packages
from setuptools import setup
@@ -25,6 +26,17 @@ cur_dir = os.path.dirname(os.path.realpath(__file__))
pkg_dir = os.path.join(cur_dir, 'build')


def clean():
# pylint: disable=unused-argument
def readonly_handler(func, path, execinfo):
os.chmod(path, stat.S_IWRITE)
func(path)
if os.path.exists(os.path.join(cur_dir, 'build')):
shutil.rmtree(os.path.join(cur_dir, 'build'), onerror=readonly_handler)
if os.path.exists(os.path.join(cur_dir, 'mindarmour.egg-info')):
shutil.rmtree(os.path.join(cur_dir, 'mindarmour.egg-info'), onerror=readonly_handler)


def write_version(file):
file.write("__version__ = '{}'\n".format(version))

@@ -36,6 +48,7 @@ def build_depends():
write_version(f)


clean()
build_depends()




Loading…
Cancel
Save