Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
a77f9508
Commit
a77f9508
authored
Jan 05, 2009
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport version_txt import tidying from trunk.
parent
16b5ee98
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
lib/python/App/tests/test_version_txt.py
lib/python/App/tests/test_version_txt.py
+7
-6
lib/python/App/version_txt.py
lib/python/App/version_txt.py
+5
-2
No files found.
lib/python/App/tests/test_version_txt.py
View file @
a77f9508
...
@@ -36,7 +36,7 @@ class VersionTextTestCase(unittest.TestCase):
...
@@ -36,7 +36,7 @@ class VersionTextTestCase(unittest.TestCase):
version_txt
.
_version_string
=
None
version_txt
.
_version_string
=
None
version_txt
.
_zope_version
=
None
version_txt
.
_zope_version
=
None
def
writeVersion
(
self
,
s
):
def
_
writeVersion
(
self
,
s
):
import
os
import
os
import
tempfile
import
tempfile
from
App
import
version_txt
from
App
import
version_txt
...
@@ -46,19 +46,20 @@ class VersionTextTestCase(unittest.TestCase):
...
@@ -46,19 +46,20 @@ class VersionTextTestCase(unittest.TestCase):
os
.
close
(
f
)
os
.
close
(
f
)
def
test_without_version_txt
(
self
):
def
test_without_version_txt
(
self
):
import
os
from
App
import
version_txt
from
App
import
version_txt
from
App.version_txt
import
getZopeVersion
version_txt
.
_filename
=
'NONESUCHFILESHOULDEXIST'
version_txt
.
_filename
=
''
self
.
failIf
(
os
.
path
.
exists
(
version_txt
.
_get_filename
()))
self
.
assertEqual
(
getZopeVersion
(),
(
-
1
,
-
1
,
-
1
,
''
,
-
1
))
self
.
assertEqual
(
version_txt
.
getZopeVersion
(),
(
-
1
,
-
1
,
-
1
,
''
,
-
1
))
def
test_with_version_txt_final
(
self
):
def
test_with_version_txt_final
(
self
):
from
App.version_txt
import
getZopeVersion
from
App.version_txt
import
getZopeVersion
self
.
writeVersion
(
"Zope 2.6.1 (source release, python 2.1, linux2)"
)
self
.
_
writeVersion
(
"Zope 2.6.1 (source release, python 2.1, linux2)"
)
self
.
assertEqual
(
getZopeVersion
(),
(
2
,
6
,
1
,
''
,
-
1
))
self
.
assertEqual
(
getZopeVersion
(),
(
2
,
6
,
1
,
''
,
-
1
))
def
test_with_version_txt_beta
(
self
):
def
test_with_version_txt_beta
(
self
):
from
App.version_txt
import
getZopeVersion
from
App.version_txt
import
getZopeVersion
self
.
writeVersion
(
"Zope 2.6.1b2 (source release, python 2.1, linux2)"
)
self
.
_
writeVersion
(
"Zope 2.6.1b2 (source release, python 2.1, linux2)"
)
self
.
assertEqual
(
getZopeVersion
(),
(
2
,
6
,
1
,
'b'
,
2
))
self
.
assertEqual
(
getZopeVersion
(),
(
2
,
6
,
1
,
'b'
,
2
))
...
...
lib/python/App/version_txt.py
View file @
a77f9508
...
@@ -17,9 +17,8 @@ $id$
...
@@ -17,9 +17,8 @@ $id$
import
os
import
os
import
re
import
re
import
sys
import
sys
import
Zope2
_location
=
os
.
path
.
dirname
(
Zope2
.
__file__
)
_location
=
None
_filename
=
'version.txt'
_filename
=
'version.txt'
_version_file
=
None
_version_file
=
None
...
@@ -27,8 +26,12 @@ _version_string = None
...
@@ -27,8 +26,12 @@ _version_string = None
_zope_version
=
None
_zope_version
=
None
def
_get_filename
():
def
_get_filename
():
global
_location
if
_version_file
is
not
None
:
if
_version_file
is
not
None
:
return
_version_file
return
_version_file
if
_location
is
None
:
import
Zope2
_location
=
os
.
path
.
dirname
(
Zope2
.
__file__
)
return
os
.
path
.
join
(
_location
,
_filename
)
return
os
.
path
.
join
(
_location
,
_filename
)
def
_prep_version_data
():
def
_prep_version_data
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment