Skip to content

Commit

Permalink
respect the sys.dont_write_bytecode flag. Fixes #147
Browse files Browse the repository at this point in the history
--HG--
branch : distribute
extra : rebase_source : 889c1badc92b1de14352a141865172b0a39384fa
  • Loading branch information
tarekziade committed May 6, 2010
1 parent b53fad8 commit 3a9c591
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CHANGES
* 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
Expand Down
10 changes: 8 additions & 2 deletions setuptools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
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__ = [
Expand Down Expand Up @@ -95,4 +96,9 @@ def findall(dir = os.curdir):
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
6 changes: 5 additions & 1 deletion setuptools/command/easy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"""
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
Expand Down Expand Up @@ -1149,6 +1149,10 @@ def pf(src,dst):
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
Expand Down

0 comments on commit 3a9c591

Please sign in to comment.