Skip to content
This repository was archived by the owner on Apr 26, 2021. It is now read-only.

Conda package #21

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
*egg*
*dist*
*tar.gz*
.idea
build
6 changes: 6 additions & 0 deletions conda/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
python:
- 2.7

numpy:
- 1.11

48 changes: 48 additions & 0 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{% set data = load_setup_py_data(setup_file="../setup.py",
from_recipe_dir=True) %}

{% set GIT_HASHTAG = os.popen("git log --pretty=format:'%h' -n 1")
.read().strip()%}

package:
name: {{data.get('name').lower().replace(' ', '_')}}
version: {{data.get('version')}}

source:
path: ..

build:
number: {{environ.get('BUILD_NUMBER',0)}}
noarch: python
script: '{{PYTHON}} setup.py install --single-version-externally-managed
--record=record.txt'

string: 'py{{CONDA_PY}}_{{ PKG_BUILDNUM }}_g{{GIT_HASHTAG}}'
entry_points: {{data.get('entry_points', {}).get('console_scripts', [])}}

requirements:
host:
- python {{python}}
- setuptools
run:
- python {{python}}
- future
- pytango

test:
requires:
- pytango
- future
imports:
{% for pack in data['packages'] %}
- {{pack}}
{% endfor %}
about:
home: {{ data.get('url')}}
license: {{ data.get('license')}}
summary: {{ data.get('description')}}
author: {{ data.get('author')}}
description: {{ data.get('long_description')}}



File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
If it is problem is solved in the future, then will be moved to fandango.linos
"""

if __name__ == '__main__':
def main():
import sys
cmd = ''
try:
Expand Down Expand Up @@ -196,3 +196,6 @@ def get_module_name(o):
sys.exit(1)

sys.exit(0)

if __name__ == '__main__':
main()
4 changes: 0 additions & 4 deletions fandango/scripts/folder-gui

This file was deleted.

51 changes: 27 additions & 24 deletions fandango/scripts/tango2csv → fandango/scripts/tango2csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,29 +165,32 @@ def tango2csv(filters,options=[]):
except Exception,e:
print '-------> An unforeseen exception occured....',traceback.format_exc()


if __name__ == '__main__':

opts = [a for a in sys.argv[1:] if a.startswith('-')]
args = [a for a in sys.argv[1:] if not a.startswith('-')]
if not args:
print(__doc__)
elif '--tree' not in opts:
tango2csv(args,opts)


def main():
opts = [a for a in sys.argv[1:] if a.startswith('-')]
args = [a for a in sys.argv[1:] if not a.startswith('-')]
if not args:
print(__doc__)
elif '--tree' not in opts:
tango2csv(args, opts)
else:
if len(args) > 1:
fout = args[-1]
args = args[:-1]
else:
if len(args)>1:
fout = args[-1]
args = args[:-1]
else:
fout = ''
fout = ''

text = fd.tango.tango2table(args, opts=opts + ['--text'])

if fout:
fout = open(fout, 'w')
fout.write(text)
fout.close()
else:
print(text)

if __name__ == '__main__':
main()


text = fd.tango.tango2table(args,opts=opts+['--text'])

if fout:
fout = open(fout,'w')
fout.write(text)
fout.close()
else:
print(text)


64 changes: 0 additions & 64 deletions fandango/scripts/tango2json

This file was deleted.

70 changes: 70 additions & 0 deletions fandango/scripts/tango2json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env python

import fandango as fn
import sys,json,gzip

__doc__ = """
Usage:

> tango2json.py [--compress] [--commands] [--properties] [--attributes] "filename.json" dev/name/1 "dev/exp/*"
"""


def main():
args,params,devs,data = [],[],[],fn.CaselessDict()

t0 = fn.now()
i = 1
source = ''

while i<len(sys.argv):
a = sys.argv[i]
if a.startswith('-'):
if a == '--source':
i+=1
source = sys.argv[i]
else:
params.append(a)
else:
args.append(a)
i+=1

if not args[1:]:
print(__doc__)
sys.exit(-1)

if not source:
for mask in args[1:]:
exported = exported='--attributes' in params
fn.log.debug("mask is %s, %s" % (mask,exported))
devs.extend(fn.get_matching_devices(mask,exported=exported))
else:
raise 'Reading attr config from file not implemented'

filename = args[0] if '--compress' not in params else args[0]+'.gz'

print('Exporting %d devices to %s'%(len(devs),filename))

for d in devs:
if d not in data:
data[d] = fn.tango.export_device_to_dict(d,
commands = '--commands' in params,
properties = '--properties' in params
)

data = fn.dict2json(data) #Do not convert, just filters

if '--compress' in params:
jdata = json.dumps(data,encoding='latin-1')
f = gzip.open(filename,'wb')
f.write(jdata)
f.close()
else:
json.dump(data,open(filename,'w'),encoding='latin-1')

print('Finished in %d seconds.'%(fn.now()-t0))
print(fn.shell_command('ls -lah %s'%filename))


if __name__ == '__main__':
main()
14 changes: 0 additions & 14 deletions fandango/scripts/tango_host

This file was deleted.

18 changes: 18 additions & 0 deletions fandango/scripts/tango_host.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env python

def main():
try:
rc = open('/etc/tangorc').readlines()
rc = [l.split('=')[1].strip() for l in rc if l.startswith('TANGO_HOST=')]
assert rc
print(rc[0])
except:
import traceback
#traceback.print_exc()
import PyTango
db = PyTango.Database()
print('%s:%s'%(db.get_db_host(),db.get_db_port()))


if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def monitor(*args, **kwargs):

#[dp.unsubscribe_event(ei) for ei in eis];

if __name__ == '__main__':
def main():
import sys
try:
args = sys.argv[1:]
Expand All @@ -105,3 +105,5 @@ def monitor(*args, **kwargs):
print(__doc__)


if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def get_property(obj,prop='',opts=[],var=''):

return list(value) if fandango.isSequence(value) else value


def main(args):
#assert args,'Arguments must be OBJECT.Property'
if not args:
Expand All @@ -91,11 +92,16 @@ def main(args):

return vals

if __name__ == '__main__':

def main_script():
import sys
value = main(sys.argv[1:])
if not value:
sys.exit(1)
else:
print('\n'.join(value) if fandango.isSequence(value) else value)
sys.exit(0)


if __name__ == '__main__':
main_script()
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

Examples:

tango_servers.py status # Will display status of devices in localhost
tango_servers.py hostname.you.org stop "*hdb*" # Will stop all *hdb* devices in hostname.you.org
tango_servers.py restart "pyalarm/*" # Will restart PyAlarm devices in ALL hosts
tango_servers status # Will display status of devices in localhost
tango_servers hostname.you.org stop "*hdb*" # Will stop all *hdb* devices in hostname.you.org
tango_servers restart "pyalarm/*" # Will restart PyAlarm devices in ALL hosts

NOTE: ctds and tango_admin scripts provide similar functionality

Expand Down
Loading