From 074676948a8f306871003cc5f54ec42d8752f55b Mon Sep 17 00:00:00 2001
From: nhertz <nhertz@nrao.edu>
Date: Mon, 27 Jul 2020 10:33:07 -0600
Subject: [PATCH] Added meta.yaml files for datafetcher and pycapo 0.3.0; some
 changes to some other files as well

---
 src/bdistrecipe/bdistrecipe.py      | 25 ++++++++++++++++++
 src/bdistrecipe/setup.py            |  8 ++++++
 src/condarecipe/condarecipe.py      | 14 +++++++++++
 src/condarecipe/setup.py            |  8 ++++++
 support/conda/datafetcher/meta.yaml | 39 +++++++++++++++++++++++++++++
 support/conda/events/meta.yaml      | 25 ++++++++++++++++++
 support/conda/pycapo/meta.yaml      |  4 +--
 7 files changed, 121 insertions(+), 2 deletions(-)
 create mode 100644 src/bdistrecipe/bdistrecipe.py
 create mode 100644 src/bdistrecipe/setup.py
 create mode 100644 src/condarecipe/condarecipe.py
 create mode 100644 src/condarecipe/setup.py
 create mode 100644 support/conda/datafetcher/meta.yaml
 create mode 100644 support/conda/events/meta.yaml

diff --git a/src/bdistrecipe/bdistrecipe.py b/src/bdistrecipe/bdistrecipe.py
new file mode 100644
index 000000000..1f637c15b
--- /dev/null
+++ b/src/bdistrecipe/bdistrecipe.py
@@ -0,0 +1,25 @@
+import os
+
+class Recipe:
+    def __init__(self, buildout, name, options):
+        options['created'] = "{}/dist/{}".format(options['path'], name + "-4.0.0a1.dev1.tar.bz2")
+        self.options = options
+
+    def install(self):
+        self.options.created(self.options['created'])
+        home = os.getcwd()
+
+        # cd into correct directory
+        os.chdir(self.options['path'])
+        # Run setup.py
+        os.system("conda run -n data python3 setup.py bdist")
+        os.chdir(home)
+        # Deploy conda package to builder
+        builder_path = "/home/builder.aoc.nrao.edu/content/conda/"
+        platform = "osx64"
+        os.system("scp {}/{} builder:{}".format(home, self.options['created'], builder_path + platform))
+        os.system("ssh builder 'cd {} && conda index'".format(builder_path))
+
+        return self.options.created()
+
+    update = install
\ No newline at end of file
diff --git a/src/bdistrecipe/setup.py b/src/bdistrecipe/setup.py
new file mode 100644
index 000000000..488a299c9
--- /dev/null
+++ b/src/bdistrecipe/setup.py
@@ -0,0 +1,8 @@
+from setuptools import setup
+
+setup(
+    name='bdistrecipe',
+    version='0.1',
+    py_modules = ['bdistrecipe'],
+    entry_points = {"zc.buildout": ["default=bdistrecipe:Recipe"]}
+)
\ No newline at end of file
diff --git a/src/condarecipe/condarecipe.py b/src/condarecipe/condarecipe.py
new file mode 100644
index 000000000..fe8bfd6fa
--- /dev/null
+++ b/src/condarecipe/condarecipe.py
@@ -0,0 +1,14 @@
+import os
+
+class Recipe:
+    def __init__(self, buildout, name, options):
+        options['created'] = "{}/envs/{}".format(options['path'], name + options['env'])
+        self.options = options
+
+    def install(self):
+        self.options.created(self.options['created'])
+        os.system("source /opt/miniconda3/etc/profile.d/conda.sh && conda activate data")
+
+        return self.options.created()
+
+    update = install
\ No newline at end of file
diff --git a/src/condarecipe/setup.py b/src/condarecipe/setup.py
new file mode 100644
index 000000000..e912bcf0f
--- /dev/null
+++ b/src/condarecipe/setup.py
@@ -0,0 +1,8 @@
+from setuptools import setup
+
+setup(
+    name='condarecipe',
+    version='0.1',
+    py_modules = ['condarecipe'],
+    entry_points = {"zc.buildout": ["default=condarecipe:Recipe"]},
+)
\ No newline at end of file
diff --git a/support/conda/datafetcher/meta.yaml b/support/conda/datafetcher/meta.yaml
new file mode 100644
index 000000000..b4c190ef4
--- /dev/null
+++ b/support/conda/datafetcher/meta.yaml
@@ -0,0 +1,39 @@
+{% set name = "datafetcher" %}
+{% set version = "4.0.0a1.dev1" %}
+
+package:
+  name: "{{ name|lower }}"
+  version: "{{ version }}"
+
+build:
+  entry_points:
+    - datafetcher = datafetcher.commands:main
+  script: python setup.py install
+
+source:
+  path: /Users/nhertz/data/apps/cli/executables/datafetcher
+
+requirements:
+  run:
+    - python
+    - pika==1.1.0
+    - pycapo
+    - bs4
+    - beautifulsoup4==4.9.1
+    - lxml==4.3.2
+    - psycopg2==2.8.5
+    - pyinstaller
+    - pyopenssl=19.1.0
+    - tox
+
+#test:
+#  requires:
+#    - pytest
+#    - pytest-runner
+#  commands:
+#    - pytest -x --showlocals
+
+about:
+  license: "GPL"
+  license_family: "GPL"
+  summary: "NRAO Archive Data Fetcher Script"
diff --git a/support/conda/events/meta.yaml b/support/conda/events/meta.yaml
new file mode 100644
index 000000000..cd0fddf43
--- /dev/null
+++ b/support/conda/events/meta.yaml
@@ -0,0 +1,25 @@
+{% set name = "events" %}
+{% set version = "4.0.0a1.dev1" %}
+
+package:
+  name: "{{ name|lower }}"
+  version: "{{ version }}"
+
+source:
+  path: /Users/nhertz/data/shared/messaging/events
+
+build:
+  number: 0
+  script:
+    - python setup.py install
+
+requirements:
+  run:
+    - python=3.8
+    - pika
+    - pycapo
+
+about:
+  license: "GPL"
+  license_family: "GPL"
+  summary: "NRAO Archive Data Fetcher Script"
diff --git a/support/conda/pycapo/meta.yaml b/support/conda/pycapo/meta.yaml
index caab0fdce..5163cca74 100644
--- a/support/conda/pycapo/meta.yaml
+++ b/support/conda/pycapo/meta.yaml
@@ -1,5 +1,5 @@
 {% set name = "pycapo" %}
-{% set version = "0.2.1.post1" %}
+{% set version = "0.3.0" %}
 
 package:
   name: "{{ name|lower }}"
@@ -7,7 +7,7 @@ package:
 
 source:
   url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
-  sha256: 703002d913d4e38a4bcce7748674ef58d4fd63c9fd099316b4643a89955ff361
+  sha256: 507d47278a66f2a67dc817e2dae533374ad0c8312aed7ab6e23e1b322baef5c6
 
 build:
   number: 0
-- 
GitLab