浏览代码

Prevent symlink recursion on install

Steven Silvester 7 年之前
父节点
当前提交
6fc5b5c6f0
共有 2 个文件被更改,包括 14 次插入1 次删除
  1. 3 1
      setup.py
  2. 11 0
      setupbase.py

+ 3 - 1
setup.py

@@ -49,7 +49,8 @@ from setupbase import (
     js_prerelease,
     CheckAssets,
     version_ns,
-    name
+    name,
+    custom_egg_info
 )
 
 
@@ -98,6 +99,7 @@ cmdclass = dict(
     sdist  = js_prerelease(sdist, strict=True),
     bdist_egg = bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled,
     jsdeps = CheckAssets,
+    egg_info = custom_egg_info
 )
 try:
     from wheel.bdist_wheel import bdist_wheel

+ 11 - 0
setupbase.py

@@ -22,6 +22,7 @@ from os.path import join as pjoin
 from distutils import log
 from distutils.cmd import Command
 from distutils.version import LooseVersion
+from setuptools.command.egg_info import egg_info
 from setuptools.command.bdist_egg import bdist_egg
 from subprocess import check_call
 
@@ -208,3 +209,13 @@ class bdist_egg_disabled(bdist_egg):
     """
     def run(self):
         sys.exit("Aborting implicit building of eggs. Use `pip install .` to install from source.")
+
+
+class custom_egg_info(egg_info):
+    """Prune node_modules folders from egg_info to avoid symlink recursion
+    """
+    def run(self):
+        folders = glob.glob(pjoin(here, 'packages', '**', 'node_modules'))
+        for folder in folders:
+            shutil.rmtree(folder)
+        return egg_info.run(self)