Skip to content

Commit

Permalink
Merge pull request #120 from mobeigi/119-add-pypi-readme
Browse files Browse the repository at this point in the history
Fixes #119: Add long description for PyPi
  • Loading branch information
mobeigi authored Dec 25, 2023
2 parents c5a7c7c + db13bf8 commit 7a7cea9
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
4 changes: 2 additions & 2 deletions fb2cal/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
from .facebook_browser import FacebookBrowser
from .transformer import Transformer

from .__init__ import __version__, __status__, __website__, __license__
from .__init__ import __version__, __status__, __github_short_url__, __license__

# Set CWD to script directory
os.chdir(sys.path[0])

# Init logger
logger = Logger('fb2cal').getLogger()
logger.info(f'Starting fb2cal v{__version__} ({__status__}) [{__website__}]')
logger.info(f'Starting fb2cal v{__version__} ({__status__}) [{__github_short_url__}]')
logger.info(f'This project is released under the {__license__} license.')

try:
Expand Down
7 changes: 5 additions & 2 deletions fb2cal/__meta__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
__version_info__ = (1, 3, 0)
__version__ = '.'.join(map(str, __version_info__))

__website__ = 'https://git.io/fjMwr'
__github_url__ = 'https://github.com/mobeigi/fb2cal'
__github_short_url__ = 'https://git.io/fjMwr'
__github_assets_absolute_url__ = 'https://raw.githubusercontent.com/mobeigi/fb2cal/master'
__download_url__= f'https://github.com/mobeigi/fb2cal/archive/v{__version__}.tar.gz'


# Make metadata public to script
__all__ = ['__author__', '__copyright__', '__description__', '__email__', '__license__', '__maintainer__', '__status__', '__title__', '__version_info__', '__version__', '__website__', '__download_url__']
__all__ = ['__author__', '__copyright__', '__description__', '__email__', '__license__', '__maintainer__', '__status__', '__title__', '__version_info__', '__version__', '__github_url__', '__github_short_url__', '__github_assets_absolute_url__', '__download_url__']
4 changes: 2 additions & 2 deletions fb2cal/ics_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from .logger import Logger
from .utils import generate_facebook_profile_url_permalink
from .__init__ import __version__, __status__, __website__
from .__init__ import __version__, __status__, __github_short_url__

""" Write Birthdays to an ICS file """
class ICSWriter:
Expand All @@ -20,7 +20,7 @@ def generate(self):
c = Calendar()
c.scale = 'GREGORIAN'
c.method = 'PUBLISH'
c.creator = f'fb2cal v{__version__} ({__status__}) [{__website__}]'
c.creator = f'fb2cal v{__version__} ({__status__}) [{__github_short_url__}]'
c.extra.append(ContentLine(name='X-WR-CALNAME', value='Facebook Birthdays (fb2cal)'))
c.extra.append(ContentLine(name='X-PUBLISHED-TTL', value='PT12H'))
c.extra.append(ContentLine(name='X-ORIGINAL-URL', value='/events/birthdays/'))
Expand Down
24 changes: 22 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
from os import path
import re
from setuptools import setup, find_packages
from fb2cal.__meta__ import __title__, __version__, __description__, __license__, __author__, __email__, __website__, __download_url__, __keywords__

from fb2cal.__meta__ import __title__, __version__, __description__, __license__, __author__, __email__, __github_url__, __github_short_url__, __github_assets_absolute_url__, __download_url__, __keywords__

def read(fname, base_url, base_image_url):
"""Read the content of a file."""
with open(path.join(path.dirname(__file__), fname)) as fd:
readme = fd.read()
if hasattr(readme, 'decode'):
# In Python 3, turn bytes into str.
readme = readme.decode('utf8')
# turn relative links into absolute ones
readme = re.sub(r'`<([^>]*)>`__',
r'`\1 <' + base_url + r"/blob/master/\1>`__",
readme)
readme = re.sub(r"\.\. image:: /", ".. image:: " + base_image_url + "/", readme)

return readme

setup(
name=__title__,
Expand All @@ -9,7 +27,7 @@
license=__license__,
author=__author__,
author_email=__email__,
url=__website__,
url=__github_short_url__,
download_url=__download_url__,
keywords=__keywords__,
python_requires='>3.9',
Expand All @@ -19,6 +37,8 @@
'requests',
'freezegun',
],
long_description=read('README.md', __github_url__, __github_assets_absolute_url__),
long_description_content_type='text/markdown',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Other Audience',
Expand Down

0 comments on commit 7a7cea9

Please sign in to comment.