Skip to content

Commit

Permalink
Python 3 support
Browse files Browse the repository at this point in the history
r9212
  • Loading branch information
tebeka committed Jun 25, 2010
1 parent 42ca680 commit 2769d4a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ recursive-include remote/client/src/py *.py
recursive-include remote/client/test/py *.py
include selenium/src/py/selenium.py
include selenium/src/py/__init__.py
include __init__.py
include docs/api/py/index.rst
recursive-include selenium.egg-info *

36 changes: 35 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,34 @@

from os.path import dirname, join
import re
import sys

def setup_python3():
# Taken from "distribute" setup.py
from distutils.filelist import FileList
from distutils import dir_util, file_util, util, log

tmp_src = join("build", "src")
log.set_verbosity(1)
fl = FileList()
for line in open("MANIFEST.in"):
if not line.strip():
continue
fl.process_template_line(line)
dir_util.create_tree(tmp_src, fl.files)
outfiles_2to3 = []
for f in fl.files:
outf, copied = file_util.copy_file(f, join(tmp_src, f), update=1)
if copied and outf.endswith(".py"):
outfiles_2to3.append(outf)

util.run_2to3(outfiles_2to3)

# arrange setup to use the copy
sys.path.insert(0, tmp_src)

return tmp_src


def find_longdesc():
for path in ("docs/api/py/index.rst", "docs/index.rst"):
Expand All @@ -28,21 +56,27 @@ def find_longdesc():
except IOError:
pass

print "WARNING: Can't find index.rst"
print("WARNING: Can't find index.rst")
return ""

def revision():
svn_rev = "$Revision$"
match = re.search("\d+", svn_rev)
return match.group() or "unknown"

if sys.version_info >= (3,):
src_root = setup_python3()
else:
src_root = "."

setup(
cmdclass={'install': install},
name='selenium',
version="2.0-dev-%s" % revision(),
description='Python bindings for Selenium',
long_description=find_longdesc(),
url='http://code.google.com/p/selenium/',
src_root=src_root,
package_dir={
'selenium':'.',
'selenium.ie': 'jobbie/src/py',
Expand Down

0 comments on commit 2769d4a

Please sign in to comment.