Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9e91591

Browse files
committed
Fix#187: store the version at a single place in the tree.
1 parent5e3d432 commit9e91591

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

‎html5lib/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@
2020

2121
__all__= ["HTMLParser","parse","parseFragment","getTreeBuilder",
2222
"getTreeWalker","serialize"]
23+
24+
# this has to be at the top level, see how setup.py parses this
2325
__version__="0.999999-dev"

‎setup.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
fromdistutils.coreimportsetup
2+
importast
23
importos
34
importcodecs
45

@@ -29,8 +30,20 @@
2930
withcodecs.open(os.path.join(current_dir,'CHANGES.rst'),'r','utf8')aschanges_file:
3031
long_description=readme_file.read()+'\n'+changes_file.read()
3132

33+
version=None
34+
withopen(os.path.join("html5lib","__init__.py"),"rb")asinit_file:
35+
t=ast.parse(init_file.read(),filename="__init__.py",mode="exec")
36+
assertisinstance(t,ast.Module)
37+
assignments=filter(lambdax:isinstance(x,ast.Assign),t.body)
38+
forainassignments:
39+
if (len(a.targets)==1and
40+
isinstance(a.targets[0],ast.Name)and
41+
a.targets[0].id=="__version__"and
42+
isinstance(a.value,ast.Str)):
43+
version=a.value.s
44+
3245
setup(name='html5lib',
33-
version='0.999999-dev',
46+
version=version,
3447
url='https://github.com/html5lib/html5lib-python',
3548
license="MIT License",
3649
description='HTML parser based on the WHATWG HTML specification',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp