"...monitoring-location/components/hydrograph/index.test.js" did not exist on "8cd19fd8014144a60e29577599d67aad9f6732c6"
Newer
Older
"""
Setuptools configuration for the Water Data For The Nation user interface.
This setup script requires that static assets have been built into the
`assets/dist` directory prior to the build.
"""
import os
from setuptools import setup, find_packages
def read_requirements():
"""
Get application requirements from
the requirements.txt file.
:return: portal_ui Python requirements
:rtype: list
"""
with open('requirements.txt', 'r') as req:
requirements = req.readlines()
install_requires = [r.strip() for r in requirements if r.find('git+') != 0]
dependency_links = [r.strip() for r in requirements if r.find('git+') == 0]
return {'install_requires': install_requires, 'dependency_links': dependency_links}
def read(filepath):
"""
Read the contents from a file.
:param str filepath: path to the file to be read
:return: file contents
:rtype: str
"""
with open(filepath, 'r') as file:
content = file.read()
return content
def identify_data_files(directory_names, exclusions=('.gitignore', '.webassets-cache')):
"""
Recursively introspect the contents of a directory. Once the contents
have been introspected, generate a list directories and sub-directories
with their contents as lists.
Any files listed in exclusions will not be included
as a data file. Please note that the list generated by this function
will override any exclusions defined in MANIFEST.in. This
means that if one specifies a file to be excluded in MANIFEST.in,
but this function includes that file as a data file, then it's
going to be in the distributable.
:param list directory_names: absolute or relative name to directories
:param tuple exclusions: tuple of all the files or directories NOT to include as a data file
:return: all contents of the directories as a list of tuples
:rtype: list
"""
directory_data_files = []
for directory_name in directory_names:
for root, _, files in os.walk(directory_name):
pathnames = [
os.path.abspath(os.path.join(root, filename))
for filename in files
if not any(ex in os.path.join(root, filename)
for ex in exclusions)
]
if pathnames:
data_file_element = (root, pathnames)
directory_data_files.append(data_file_element)
return directory_data_files
setup(name='usgs_waterdata_ui',
version='0.1.0dev',
description='USGS Water Data',
author='Mary Bucknell, Andrew Yan, Dan Naab, Janell Fry',
author_email='mbucknell@usgs.gov',
packages=find_packages(),
include_package_data=True,
long_description=read('README.md'),
install_requires=read_requirements()['install_requires'],
platforms='any',
test_suite='unittest:TestLoader',
zip_safe=False,
# include the tier agnostic configuration file in the distributable
# the file gets placed in site-packages upon dist installation
py_modules=['config'],
# include static files in the distributable
# they will appear in the root of the virtualenv upon dist installation
data_files=identify_data_files(['assets/dist', 'data']))