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
559e24e0
Commit
559e24e0
authored
Oct 01, 2001
by
Shane Hathaway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged hotfix registry branch.
parent
5ad990a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
8 deletions
+95
-8
lib/python/App/Hotfixes.py
lib/python/App/Hotfixes.py
+38
-0
lib/python/App/version_txt.py
lib/python/App/version_txt.py
+57
-8
No files found.
lib/python/App/Hotfixes.py
0 → 100644
View file @
559e24e0
from
version_txt
import
getZopeVersion
from
zLOG
import
LOG
,
INFO
,
WARNING
merged_hotfixes
=
{
}
def
isMerged
(
name
):
return
merged_hotfixes
.
get
(
name
,
0
)
def
logHotfix
(
id
,
apply_hotfix
):
if
apply_hotfix
>
0
:
LOG
(
'Hotfixes'
,
INFO
,
'Applying %s'
%
id
)
elif
apply_hotfix
<
0
:
LOG
(
'Hotfixes'
,
WARNING
,
'Not applying %s. It is not designed for '
'this version of Zope. Please uninstall the hotfix product.'
%
id
)
else
:
LOG
(
'Hotfixes'
,
WARNING
,
'Not applying %s. The fix has already been '
'merged into Zope. Please uninstall the hotfix product.'
%
id
)
def
beforeApplyHotfix
(
id
,
req_major
,
req_minor
,
req_micro
):
apply_hotfix
=
0
major
,
minor
,
micro
=
getZopeVersion
()[:
3
]
if
major
>
0
and
(
(
major
*
10000
+
minor
*
100
+
micro
)
<
(
req_major
*
10000
+
req_minor
*
100
+
req_micro
)):
# The version of Zope is too old for this hotfix.
apply_hotfix
=
-
1
elif
not
isMerged
(
id
):
apply_hotfix
=
1
logHotfix
(
id
,
apply_hotfix
)
return
apply_hotfix
lib/python/App/version_txt.py
View file @
559e24e0
...
...
@@ -87,13 +87,62 @@ import os,sys,string,re
v
=
sys
.
version_info
def
version_txt
():
_version_string
=
None
_zope_version
=
None
def
intval
(
dict
,
key
):
v
=
dict
.
get
(
key
,
None
)
if
v
is
None
:
return
0
else
:
return
int
(
v
)
def
strval
(
dict
,
key
):
v
=
dict
.
get
(
key
,
None
)
if
v
is
None
:
return
''
else
:
return
str
(
v
)
try
:
s
=
open
(
os
.
path
.
join
(
SOFTWARE_HOME
,
'version.txt'
)).
read
()
s
=
re
.
sub
(
"
\
(.*?
\
)
\
?
"
,"",s)
s= '(%s, python %d.%d.%d, %s)' % (s,v[0],v[1],v[2],sys.platform)
return s
except:
return '(unreleased version, python %d.%d.%d, %s)' % (v[0],v[1],v[2],sys.platform)
def
_prep_version_data
():
global
_version_string
,
_zope_version
if
_version_string
is
None
:
try
:
s
=
open
(
os
.
path
.
join
(
SOFTWARE_HOME
,
'version.txt'
)).
read
()
ss
=
re
.
sub
(
"
\
(.*?
\
)
\
?
"
,"",s)
ss = '%s, python %d.%d.%d, %s' % (ss,v[0],v[1],v[2],sys.platform)
_version_string = ss
expr = re.compile(
r'(?P<product>[A-Za-z0-9]+) +(?P<major>[0-9]+)'
'
\
.(?P<mi
n
or>[0-9]+)
\
.(?P<mic
r
o>[0-9]+)'
'(?P<status>[A-Za-z]+)?(?P<release>[0-9]+)?')
dict = expr.match(s).groupdict()
_zope_version = (
intval(dict, 'major'),
intval(dict, 'minor'),
intval(dict, 'micro'),
strval(dict, 'status'),
intval(dict, 'release'))
except:
ss = 'unreleased version, python %d.%d.%d, %s' % (
v[0],v[1],v[2],sys.platform)
_version_string = ss
_zope_version = (-1, -1, -1, '', -1)
def version_txt():
_prep_version_data()
return '(%s)' % _version_string
def getZopeVersion():
"""
Format of zope_version tuple:
(major <int>, minor <int>, micro <int>, status <string>, release <int>)
If unreleased, integers may be -1.
"""
_prep_version_data()
return _zope_version
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