From 58d99dcae68bd89d76df917729a34de332474afb Mon Sep 17 00:00:00 2001 From: Jose Gomez-Dans Date: Fri, 12 Oct 2018 16:06:35 +0100 Subject: [PATCH] Ensure that PROSPECT spectra are stored in library I think the PROSPECT spectra are now distributed with the library. Addresses #11, @MarcYin can you please test? Thanks! --- MANIFEST.in | 1 + prosail/__init__.py | 6 ++++++ recipe/meta.yaml | 4 ++-- setup.py | 27 ++++++++++++++++++++++++--- 4 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 MANIFEST.in diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..1fcddeb --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +recursive-include prosail/ *.txt diff --git a/prosail/__init__.py b/prosail/__init__.py index 24bfb91..4098b97 100644 --- a/prosail/__init__.py +++ b/prosail/__init__.py @@ -1,4 +1,10 @@ #!/usr/bin/env python +__author__ = "J Gomez-Dans" +__copyright__ = "Copyright 2017, 2018 J Gomez-Dans" +__version__ = "2.0.2" +__license__ = "GPLv3" +__email__ = "j.gomez-dans@ucl.ac.uk" + from .spectral_library import get_spectra spectral_lib = get_spectra() from .prospect_d import run_prospect diff --git a/recipe/meta.yaml b/recipe/meta.yaml index ad58f16..169b035 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,9 +1,9 @@ package: name: prosail - version: 2.0.1-1 + version: 2.0.2 source: - git_tag: 2.0.1-1 + git_tag: 2.0.2 git_url: http://github.com/jgomezdans/prosail.git requirements: diff --git a/setup.py b/setup.py index 737a0a9..28bbc90 100644 --- a/setup.py +++ b/setup.py @@ -1,21 +1,39 @@ #!/usr/bin/env python """Setup script for building prosail's python bindings""" -from setuptools import setup import os +import codecs +import re +from os import path +from setuptools import setup + # Global variables for this extension: name = "prosail" # name of the generated python extension (.so) description = "PROSPECT, SAIL and PROSAIL Python wrappers" long_description = "The PROSPECT + SAILh radiative transfer models from Python" +this_directory = path.abspath(path.dirname(__file__)) def read(filename): - with open(os.path.join(os.path.dirname(__file__), filename), "rb") as f: + with open(os.path.join(this_directory, filename), "rb") as f: return f.read().decode("utf-8") if os.path.exists("README.md"): long_description = read("README.md") +def read(*parts): + with codecs.open(os.path.join(this_directory, *parts), 'r') as fp: + return fp.read() + +def find_version(*file_paths): + version_file = read(*file_paths) + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", + version_file, re.M) + if version_match: + return version_match.group(1) + raise RuntimeError("Unable to find version string.") + + author = "J Gomez-Dans/NCEO & University College London" author_email = "j.gomez-dans@ucl.ac.uk" url = "http://github.com/jgomezdans/prosail" @@ -35,6 +53,9 @@ def read(filename): 'Environment :: Console' ] + + + setup( name=name, description=description, @@ -52,7 +73,7 @@ def read(filename): "scipy", "pytest", ], - version="2.0.1-1", + version=find_version("prosail", "__init__.py"), packages=["prosail"], zip_safe=False # Apparently needed for conda )