[Python-checkins] r65947 - in sandbox/trunk/setuptools/setuptools: depends.py tests/__init__.py
phillip.eby
python-checkins at python.org
Thu Aug 21 20:34:38 CEST 2008
Author: phillip.eby
Date: Thu Aug 21 20:34:37 2008
New Revision: 65947
Log:
Fix for http://bugs.python.org/setuptools/issue31
Modified:
sandbox/trunk/setuptools/setuptools/depends.py
sandbox/trunk/setuptools/setuptools/tests/__init__.py
Modified: sandbox/trunk/setuptools/setuptools/depends.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/depends.py (original)
+++ sandbox/trunk/setuptools/setuptools/depends.py Thu Aug 21 20:34:37 2008
@@ -204,7 +204,6 @@
def extract_constant(code,symbol,default=-1):
-
"""Extract the constant value of 'symbol' from 'code'
If the name 'symbol' is bound to a constant value by the Python code
@@ -237,3 +236,11 @@
return const
else:
const = default
+
+if sys.platform.startswith('java') or sys.platform == 'cli':
+ # XXX it'd be better to test assertions about bytecode instead...
+ del extract_constant, get_module_constant
+ __all__.remove('extract_constant')
+ __all__.remove('get_module_constant')
+
+
Modified: sandbox/trunk/setuptools/setuptools/tests/__init__.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/tests/__init__.py (original)
+++ sandbox/trunk/setuptools/setuptools/tests/__init__.py Thu Aug 21 20:34:37 2008
@@ -1,5 +1,4 @@
"""Tests for the 'setuptools' package"""
-
from unittest import TestSuite, TestCase, makeSuite, defaultTestLoader
import distutils.core, distutils.cmd
from distutils.errors import DistutilsOptionError, DistutilsPlatformError
@@ -7,8 +6,8 @@
import setuptools, setuptools.dist
from setuptools import Feature
from distutils.core import Extension
-from setuptools.depends import extract_constant, get_module_constant
-from setuptools.depends import find_module, Require
+extract_constant, get_module_constant = None, None
+from setuptools.depends import *
from distutils.version import StrictVersion, LooseVersion
from distutils.util import convert_path
import sys, os.path
@@ -40,14 +39,10 @@
-
-
-
class DependsTests(TestCase):
def testExtractConst(self):
-
- from setuptools.depends import extract_constant
+ if not extract_constant: return # skip on non-bytecode platforms
def f1():
global x,y,z
@@ -73,6 +68,7 @@
f,p,i = find_module('setuptools.tests'); f.close()
def testModuleExtract(self):
+ if not get_module_constant: return # skip on non-bytecode platforms
from distutils import __version__
self.assertEqual(
get_module_constant('distutils','__version__'), __version__
@@ -85,6 +81,7 @@
)
def testRequire(self):
+ if not extract_constant: return # skip on non-bytecode platforms
req = Require('Distutils','1.0.3','distutils')
@@ -124,7 +121,6 @@
self.failUnless(req.is_current(paths))
-
class DistroTests(TestCase):
def setUp(self):
@@ -366,3 +362,8 @@
ts5 = makeSetup().get_command_obj('test')
ts5.ensure_finalized()
self.assertEqual(ts5.test_suite, None)
+
+
+
+
+
More information about the Python-checkins
mailing list