Tarek Ziadé avatar Tarek Ziadé committed e009878

respect the sys.dont_write_bytecode flag. Fixes #147

Comments (0)

Files changed (3)

 * Issue 100: Fixed develop --user not taking '.' in PYTHONPATH into account
 * Issue 134: removed spurious UserWarnings. Patch by VanLindberg
 * Issue 138: cant_write_to_target error when setup_requires is used.
+* Issue 147: respect the sys.dont_write_bytecode flag
 
 ------
 0.6.10

setuptools/__init__.py

 from setuptools.depends import Require
 from distutils.core import Command as _Command
 from distutils.util import convert_path
-import os.path
+import os
+import sys
 
 __version__ = '0.6'
 __all__ = [
 import distutils.filelist
 distutils.filelist.findall = findall    # fix findall bug in distutils.
 
-
+# sys.dont_write_bytecode was introduced in Python 2.6.
+if ((hasattr(sys, "dont_write_bytecode") and sys.dont_write_bytecode) or
+    (not hasattr(sys, "dont_write_bytecode") and os.environ.get("PYTHONDONTWRITEBYTECODE"))):
+    _dont_write_bytecode = True
+else:
+    _dont_write_bytecode = False

setuptools/command/easy_install.py

 """
 import sys, os.path, zipimport, shutil, tempfile, zipfile, re, stat, random
 from glob import glob
-from setuptools import Command
+from setuptools import Command, _dont_write_bytecode
 from setuptools.sandbox import run_setup
 from distutils import log, dir_util
 from distutils.util import convert_path, subst_vars
                 chmod(f, mode)
 
     def byte_compile(self, to_compile):
+        if _dont_write_bytecode:
+            self.warn('byte-compiling is disabled, skipping.')
+            return
+
         from distutils.util import byte_compile
         try:
             # try to make the byte compile messages quieter
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.