setup.py
def parse_description():
    """
    Parse the description in the README file

    CommandLine:
        python -c "import setup; print(setup.parse_description())"
    """
    from os.path import dirname, join, exists
    readme_fpath = join(dirname(__file__), 'README.md')
    # print('readme_fpath = %r' % (readme_fpath,))
    # This breaks on pip install, so check that it exists.
    if exists(readme_fpath):
        # try:
        #     # convert markdown to rst for pypi
        #     import pypandoc
        #     return pypandoc.convert(readme_fpath, 'rst')
        # except Exception as ex:
            # strip out markdown to make a clean readme for pypi
            textlines = []
            with open(readme_fpath, 'r') as f:
                capture = False
                for line in f.readlines():
                    if '# Purpose' in line:
                        capture = True
                    elif line.startswith('##'):
                        break
                    elif capture:
                        textlines += [line]
            text = ''.join(textlines).strip()
            text = text.replace('\n\n', '_NLHACK_')
            text = text.replace('\n', ' ')
            text = text.replace('_NLHACK_', '\n\n')
            return text
    return ''
def parse_description():
    """
    Parse the description in the README file

    CommandLine:
        python -c "import setup; print(setup.parse_description())"
    """
    from os.path import dirname, join, exists
    readme_fpath = join(dirname(__file__), 'README.md')
    # print('readme_fpath = %r' % (readme_fpath,))
    # This breaks on pip install, so check that it exists.
    if exists(readme_fpath):
        # try:
        #     # convert markdown to rst for pypi
        #     import pypandoc
        #     return pypandoc.convert(readme_fpath, 'rst')
        # except Exception as ex:
            # strip out markdown to make a clean readme for pypi
            textlines = []
            with open(readme_fpath, 'r') as f:
                capture = False
                for line in f.readlines():
                    if '# Purpose' in line:
                        capture = True
                    elif line.startswith('##'):
                        break
                    elif capture:
                        textlines += [line]
            text = ''.join(textlines).strip()
            text = text.replace('\n\n', '_NLHACK_')
            text = text.replace('\n', ' ')
            text = text.replace('_NLHACK_', '\n\n')
            return text
    return ''
def parse_description ( ) : from os . path import dirname , join , exists readme_fpath = join ( dirname ( __file__ ) , 'README.md' ) # print('readme_fpath = %r' % (readme_fpath,)) # This breaks on pip install, so check that it exists. if exists ( readme_fpath ) : # try: #     # convert markdown to rst for pypi #     import pypandoc #     return pypandoc.convert(readme_fpath, 'rst') # except Exception as ex: # strip out markdown to make a clean readme for pypi textlines = [ ] with open ( readme_fpath , 'r' ) as f : capture = False for line in f . readlines ( ) : if '# Purpose' in line : capture = True elif line . startswith ( '##' ) : break elif capture : textlines += [ line ] text = '' . join ( textlines ) . strip ( ) text = text . replace ( '\n\n' , '_NLHACK_' ) text = text . replace ( '\n' , ' ' ) text = text . replace ( '_NLHACK_' , '\n\n' ) return text return ''
Parse the description in the README file

    CommandLine:
        python -c "import setup; print(setup.parse_description())"
Parse the description in the README file