Commit bd6f0254 authored by Tanner Prestegard's avatar Tanner Prestegard

One place to set version.

Created ligo/gracedb/vrsion.py, which is imported in __init__.py,
rest.py, and setup.py to keep versioning simple. Still have to set
the version in the packaging files, though.
parent 689d1255
......@@ -3,13 +3,7 @@ Packaging procedure:
1. alter these files w/new version/release numbers:
ligo-gracedb.spec
debian/changelog (timestamp comes from relevant git hash)
setup.py
ligo/gracedb/__init__.py
ligo/gracedb/cli.py
ligo/gracedb/test/test.py
bin/gracedb
(in other words, whatever has GIT_TAG in it).
ligo/gracedb/version.py
2. check that the package is good
......@@ -18,7 +12,7 @@ Packaging procedure:
git push --tags
4. generate the source tarball to put into the repo
python setup.py sdist
python setup.py sdist bdist_wheel
*. to generate .deb and .rpm for testing.
python setup.py bdist_rpm
......
......@@ -15,11 +15,10 @@
#
# You should have received a copy of the GNU General Public License
# along with gracedb. If not, see <http://www.gnu.org/licenses/>.
from .version import __version__
__all__ = ["cli", "exceptions", "rest"]
GIT_TAG = 'gracedb-1.28-1'
# issue 717. Required for backward compatibility -- make sure "from ligo import gracedb"
# works as it used to.
from .cli import *
......
......@@ -26,8 +26,6 @@ DEFAULT_SERVICE_URL = "https://gracedb.ligo.org/api"
DEFAULT_BASIC_URL = "https://gracedb.ligo.org/apibasic/"
GIT_TAG = 'gracedb-1.28-1'
DEFAULT_COLUMNS = "graceid,labels,group,pipeline,search,far,gpstime,created,dataurl"
#-----------------------------------------------------------------
......
......@@ -35,8 +35,8 @@ import six
from six.moves import map
from .exceptions import HTTPError
from .version import __version__
GIT_TAG = '2.0.0.dev0'
DEFAULT_SERVICE_URL = "https://gracedb.ligo.org/api/"
DEFAULT_BASIC_SERVICE_URL = "https://gracedb.ligo.org/apibasic/"
KNOWN_TEST_HOSTS = ['moe.phys.uwm.edu', 'embb-dev.ligo.caltech.edu', 'simdb.phys.uwm.edu',]
......@@ -332,7 +332,7 @@ class GsiRest(object):
# Add version string to user-agent header
version_header = {'User-Agent': 'gracedb-client/{version}'.format(
version=GIT_TAG)}
version=__version__)}
if headers is None:
headers = version_header
else:
......
......@@ -368,39 +368,6 @@ class TestMain(TestGraceDb):
gracedb.error
gracedb.ProxyHTTPSConnection
def test_gittag(self):
# try to make sure GIT_TAG is set properly.
import errno
version = "1.28"
try:
# If we are in the source dir (setup.py is available)
# make sure the version above agrees.
if os.path.exists("setup.py"):
setup_file = open("setup.py", 'r')
else:
setup_file = open("../../../setup.py", 'r')
v = ""
for line in setup_file:
if line.startswith("version"):
v = line.split('"')[1]
break
self.assertEqual(v, version)
except IOError as e:
if e.errno != errno.ENOENT:
raise
# GIT_TAG should look like "gracedb-VERSION-PKG"
# and VERSION should == version from above.
from ligo.gracedb import GIT_TAG as package_tag
package_tag = package_tag.split('-')[1]
self.assertTrue(package_tag.startswith(v))
from ligo.gracedb.cli import GIT_TAG as cli_tag
cli_tag = cli_tag.split('-')[1]
self.assertTrue(cli_tag.startswith(v))
self.assertEqual(cli_tag, package_tag)
if __name__ == "__main__":
# Import other unit tests
......
__version__ = '1.28'
......@@ -18,12 +18,11 @@
import os
from setuptools import setup, find_packages
version = "1.28"
from ligo.gracedb import __version__
setup(
name = "ligo-gracedb",
version = version,
version = __version__,
maintainer = "Tanner Prestegard, Alexander Pace",
maintainer_email = "tanner.prestegard@ligo.org, alexander.pace@ligo.org",
description = "Gravitational Wave Candidate Event Database",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment