Skip to content
Snippets Groups Projects
Commit 9da81863 authored by Nathan Hertz's avatar Nathan Hertz
Browse files

Updated meta.yaml gen format; datafetcher and faultchecker tested and both...

Updated meta.yaml gen format; datafetcher and faultchecker tested and both work on Mac and Linux (faultchecker doesn't install pika when installing it for some reason)
parent 98f864c0
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ dependencies:
- pyramid_debugtoolbar=4.5
- pysftp=0.2.9
- pytest=5.4
- python>=3.8.5,<3.9
- python=3.8
- requests>=2.23,<3.0
- simplejson=3.17
- sqlalchemy=1.3
......
import setuptools, importlib, subprocess, os, re
PYTHON_VERSION = '3.8'
def write_metafile(metadata, filepath):
"""
Writes given metadata to file with given path.
......@@ -36,19 +38,25 @@ def generate_metadata(setup_dict, path):
:return: Formatted string if requirements exists; else empty string.
"""
reqs_string = ''
reqs_list = ''
if 'install_requires' in setup_dict.keys():
reqs_string += 'requirements:\n'
build_reqs = ' build:\n'
run_reqs = ' run:\n'
host_reqs = ' host:\n'
reqs_list += ' - python={}\n'.format(PYTHON_VERSION)
for req in setup_dict['install_requires'].split(', '):
build_reqs += ' - {}\n'.format(req)
run_reqs += ' - {}\n'.format(req)
reqs_string += build_reqs + run_reqs
reqs_list += ' - {}\n'.format(req)
reqs_string += build_reqs + reqs_list + \
run_reqs + reqs_list + \
host_reqs + reqs_list + \
'\n'
return reqs_string
def fmt_test():
"""
Format test section of metadata.
NOTE: May need further tweaking to be smarter based on individual project
needs. For now, it's pretty dumb.
:return: Formatted string if tests_require exists; else empty string.
"""
test_string = ''
......@@ -66,16 +74,17 @@ def generate_metadata(setup_dict, path):
test_string += (
' commands:\n'
' - pytest -vv --log-level=DEBUG --showlocals\n'
'\n'
)
return test_string
name = setup_dict['name']
version = setup_dict['version']
entry_points = fmt_ep()
path = path.replace("./", "")
pth = path.replace("./", "")
requirements = fmt_reqs()
test = fmt_test()
license = setup_dict['license']
lic = setup_dict['license']
summary = setup_dict['description']
with open('tools/metafile_template.txt', 'r') as f:
......@@ -85,10 +94,10 @@ def generate_metadata(setup_dict, path):
name = name,
version = version,
entry_points = entry_points,
path = path,
path = "../../" + pth,
requirements = requirements,
test = test,
license = license,
license = lic,
summary = summary
)
......@@ -138,7 +147,7 @@ def parse_setup(d):
def get_outputs(names):
"""
Generate list of metadata files that will be created.
:param names: List of names of all subprojects with a setup.py file.
:param dirs: List of dirs of all subprojects with a setup.py file.
:return: List of paths to output files as strings.
"""
outputs = []
......
Copyright (c) 2015-2018, conda-forge
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of staged-recipes nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
......@@ -6,13 +6,13 @@ package:
version: "{{{{ version }}}}"
build:
{entry_points} script: "python setup.py install"
noarch: python
{entry_points} script: "{{{{ PYTHON }}}} setup.py install --single-version-externally-managed --record=record.txt"
source:
path: {path}
{requirements}{test}
about:
{requirements}{test}about:
license: "{license}"
license_family: "{license}"
summary: "{summary}"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment