diff --git a/release.py b/release.py
index fb559c5b73cd0f6c20a7cb80a5f66ee79d909362..bd73cef33a25d392e5b91b969213eb95075f1c7c 100644
--- a/release.py
+++ b/release.py
@@ -60,8 +60,8 @@ def main(args):
     version, date = args
 
     replace("setup.py",
-            r'version="\S+"',
-            'version="%s"' % version)
+            r'^VERSION = "\S+"$',
+            'VERSION = "%s"' % version)
     replace("src/ZODB/__init__.py",
             r'__version__ = "\S+"',
             '__version__ = "%s"' % version)
diff --git a/setup.py b/setup.py
index 7cde9f0815282857ecbd130320288b6f3fd962e7..2fb500bc4520cc331a899757c2b3edecbd7e680e 100644
--- a/setup.py
+++ b/setup.py
@@ -19,6 +19,8 @@ import sys
 
 import zpkgsetup.setup
 
+# Note that release.py must be able to recognize the VERSION line.
+VERSION = "3.5a6"
 
 here = os.path.dirname(os.path.abspath(__file__))
 
@@ -27,9 +29,7 @@ def join(*parts):
     relative_path = posixpath.join(*parts)
     return local_full_path, relative_path
 
-
-context = zpkgsetup.setup.SetupContext(
-    "ZODB3", "3.5.0a42", __file__)
+context = zpkgsetup.setup.SetupContext("ZODB3", VERSION, __file__)
 
 context.load_metadata(
     os.path.join(here, "PUBLICATION.cfg"))