Skip to content

Commit

Permalink
Merge d31cd3b into 49e2b36
Browse files Browse the repository at this point in the history
  • Loading branch information
bhazelton committed Mar 31, 2017
2 parents 49e2b36 + d31cd3b commit 9c91762
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 42 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ var/
*.egg-info/
.installed.cfg
*.egg
pyuvdata/version.py

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
13 changes: 1 addition & 12 deletions pyuvdata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,4 @@
from .uvfits import *
from .fhd import *
from .miriad import *


try:
from .version import *
__version__ = version
except ImportError:
# TODO: Issue a warning using the logging framework
__version__ = ''
git_origin = ''
git_hash = ''
git_description = ''
git_branch = ''
from .version import *
41 changes: 41 additions & 0 deletions pyuvdata/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import os
import subprocess
from data import DATA_PATH


def construct_version_info():
version_file = os.path.join(os.path.dirname(os.path.dirname(DATA_PATH)), 'VERSION')
version = open(version_file).read().strip()

try:
git_origin = subprocess.check_output(['git', 'config', '--get', 'remote.origin.url'],
stderr=subprocess.STDOUT).strip()
git_hash = subprocess.check_output(['git', 'rev-parse', 'HEAD'],
stderr=subprocess.STDOUT).strip()
git_description = subprocess.check_output(['git', 'describe', '--dirty']).strip()
git_branch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
stderr=subprocess.STDOUT).strip()
git_version = subprocess.check_output(['git', 'describe', '--abbrev=0']).strip()
except:
git_origin = ''
git_hash = ''
git_description = ''
git_branch = ''

version_info = {'version': version, 'git_origin': git_origin,
'git_hash': git_hash, 'git_description': git_description,
'git_branch': git_branch}
return version_info

version_info = construct_version_info()
version = version_info['version']
git_origin = version_info['git_origin']
git_hash = version_info['git_hash']
git_description = version_info['git_description']
git_branch = version_info['git_branch']

if __name__ == '__main__':
print('Version = {0}'.format(version))
print('git origin = {0}'.format(git_origin))
print('git branch = {0}'.format(git_branch))
print('git description = {0}'.format(git_description))
30 changes: 1 addition & 29 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,6 @@
from os import listdir
import subprocess

print "Generating pyuvdata/__version__.py: ",
try:
__version__ = open('VERSION').read().strip()
except:
__version__ = ''
try:
git_origin = subprocess.check_output(['git', 'config', '--get', 'remote.origin.url'],
stderr=subprocess.STDOUT).strip()
git_hash = subprocess.check_output(['git', 'rev-parse', 'HEAD'],
stderr=subprocess.STDOUT).strip()
git_description = subprocess.check_output(['git', 'describe', '--dirty']).strip()
git_branch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
stderr=subprocess.STDOUT).strip()
git_version = subprocess.check_output(['git', 'describe', '--abbrev=0']).strip()
except:
git_origin = ''
git_hash = ''
git_description = ''
git_branch = ''

print('Version = {0}'.format(__version__))
print('git origin = {0}'.format(git_origin))
print('git description = {0}'.format(git_description))
version_text = ('version = "{0}"\ngit_origin = "{1}"\ngit_hash = "{2}"\n' +
'git_description = "{3}"\ngit_branch = "{4}"'
).format(__version__, git_origin, git_hash, git_description, git_branch)
open('pyuvdata/version.py', 'w').write(version_text)

setup_args = {
'name': 'pyuvdata',
'author': 'HERA Team',
Expand All @@ -41,7 +13,7 @@
'package_dir': {'pyuvdata': 'pyuvdata', 'uvdata': 'uvdata'},
'packages': ['pyuvdata', 'uvdata'],
'scripts': glob.glob('scripts/*'),
'version': __version__,
'version': open('VERSION').read().strip(),
'package_data': {'pyuvdata': [f for f in listdir('./pyuvdata/data') if op.isfile(op.join('./pyuvdata/data', f))]},
'install_requires': ['numpy>=1.10', 'scipy', 'astropy>=1.2', 'pyephem', 'aipy'],
'classifiers': ['Development Status :: 5 - Production/Stable',
Expand Down

0 comments on commit 9c91762

Please sign in to comment.