Permalink
Browse files

[svn r3443] r3804@delle: sbehnel | 2008-03-17 17:09:07 +0100

 setupinfo.py fix for testing Cython version

--HG--
branch : trunk
  • Loading branch information...
1 parent d9950d1 commit 2de211816ac86d2380061c1bc32c3640639188c9 scoder committed Mar 17, 2008
Showing with 25 additions and 12 deletions.
  1. +7 −7 setupinfo.py
  2. +18 −5 versioninfo.py
View
@@ -1,6 +1,8 @@
import sys, os, os.path
from distutils.core import Extension
+from versioninfo import get_base_dir, split_version
+
try:
from Cython.Distutils import build_ext as build_pyx
import Cython.Compiler.Version
@@ -78,10 +80,11 @@ def ext_modules(static_include_dirs, static_library_dirs, static_cflags):
return result
def find_dependencies(module):
- if CYTHON_INSTALLED:
- from Cython.Compiler.Version import version
- if tuple(version.split('.')) <= (0,9,6,12):
- return []
+ if not CYTHON_INSTALLED:
+ return []
+ from Cython.Compiler.Version import version
+ if split_version(version) <= (0,9,6,12):
+ return []
package_dir = os.path.join(get_base_dir(), PACKAGE_PATH)
files = os.listdir(package_dir)
@@ -255,9 +258,6 @@ def has_option(name):
except ValueError:
return False
-def get_base_dir():
- return os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]))
-
# pick up any commandline options
OPTION_WITHOUT_OBJECTIFY = has_option('without-objectify')
OPTION_WITHOUT_ASSERT = has_option('without-assert')
View
@@ -5,7 +5,7 @@
def version():
global __LXML_VERSION
if __LXML_VERSION is None:
- __LXML_VERSION = open(os.path.join(get_src_dir(), 'version.txt')).read().strip()
+ __LXML_VERSION = open(os.path.join(get_base_dir(), 'version.txt')).read().strip()
return __LXML_VERSION
def branch_version():
@@ -17,7 +17,7 @@ def is_pre_release():
def svn_version():
_version = version()
- src_dir = get_src_dir()
+ src_dir = get_base_dir()
revision = 0
base_url = None
@@ -89,7 +89,7 @@ def changes():
"""Extract part of changelog pertaining to version.
"""
_version = version()
- f = open(os.path.join(get_src_dir(), "CHANGES.txt"), 'r')
+ f = open(os.path.join(get_base_dir(), "CHANGES.txt"), 'r')
lines = []
for line in f:
if line.startswith('====='):
@@ -114,7 +114,7 @@ def create_version_h(svn_version):
svn_version += '.0'
version_h = open(
- os.path.join(get_src_dir(), 'src', 'lxml', 'lxml-version.h'),
+ os.path.join(get_base_dir(), 'src', 'lxml', 'lxml-version.h'),
'w')
version_h.write('''\
#ifndef LXML_VERSION_STRING
@@ -123,10 +123,23 @@ def create_version_h(svn_version):
''' % svn_version)
version_h.close()
-def get_src_dir():
+def get_base_dir():
return os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]))
def fix_alphabeta(version, alphabeta):
if ('.' + alphabeta) in version:
return version
return version.replace(alphabeta, '.' + alphabeta)
+
+def split_version(version):
+ find_digits = re.compile('([0-9]+)(.*)').match
+ l = []
+ for part in version.split('.'):
+ try:
+ l.append( int(part) )
+ except ValueError:
+ match = find_digits(part)
+ if match:
+ l.append( int(match.group(1)) )
+ l.append( match.group(2) )
+ return tuple(l)

0 comments on commit 2de2118

Please sign in to comment.