Skip to content

Commit

Permalink
Merge pull request #480 from azavea/rde/fix/pypi-readme
Browse files Browse the repository at this point in the history
Replace image links in README with static links for pypi config
  • Loading branch information
lossyrob committed Oct 10, 2018
2 parents 0fce832 + 9876174 commit 579b378
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from os import path as op
import json
import io
import re
from setuptools import (setup, find_packages)
from imp import load_source

Expand All @@ -20,6 +21,16 @@
x.strip().replace('git+', '') for x in all_reqs if 'git+' not in x
]

def replace_images(readme):
"""Replaces image links in the README with static links to
the GitHub release branch."""
release_branch = '.'.join(__version__.split('.')[:2])
r = r'\((docs/)(.*\.png)'
rep = (r'(https://raw.githubusercontent.com/azavea/raster-vision/'
'{}/docs/\g<2>'.format(release_branch))

return re.sub(r, rep, readme)

# Dependencies for extras, which pertain to installing specific backends.
with io.open(op.join(here, 'extras_requirements.json'), encoding='utf-8') as f:
extras_require = json.loads(f.read())
Expand All @@ -29,7 +40,7 @@
version=__version__,
description='An open source framework for deep learning '
'on satellite and aerial imagery',
long_description=open('README.md').read(),
long_description=replace_images(open('README.md').read()),
long_description_content_type='text/markdown',
url='https://github.com/azavea/raster-vision',
author='Azavea',
Expand Down

0 comments on commit 579b378

Please sign in to comment.