<filename>conanfile.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from conans import ConanFile, tools
import os


class NameofConan(ConanFile):
    name = 'nameof'
    version = '0.8.3'
    commit_id = 'v' + version
    sha256sum = 'd24b8deefc750be335d7d8bd0d9b11f6f2566b78a06307919955a3856c4b5e55'
    description = 'Header-only C++17 library provides nameof macros and functions to obtain simple name of variable, type, function, macro, and enum.'
    topics = (
        'conan',
        'nameof',
        'introspection',
        'compile-time'
    )
    url = 'https://github.com/steakhal/conan-nameof'
    homepage = 'https://github.com/Neargye/nameof'
    author = '<NAME> <<EMAIL>>'
    license = 'MIT'
    no_copy_source = True
    exports = ['LICENSE.md']
    _source_subfolder = 'source_subfolder'

    def source(self):
        tools.get('{0}/archive/{1}.tar.gz'.format(self.homepage, self.commit_id), sha256=self.sha256sum)
        extracted_dir = 'nameof-' + self.version

        #Rename to 'source_folder' is a convention to simplify later steps
        os.rename(extracted_dir, self._source_subfolder)

    def package(self):
        include_folder = os.path.join(self._source_subfolder, 'include')
        self.copy(pattern='LICENSE', dst='licenses', src=self._source_subfolder)
        self.copy(pattern='*', dst='include', src=include_folder)

    def package_id(self):
        self.info.header_only()
