django-markdownx/setup.py

140 lines
3.9 KiB
Python
Raw Permalink Normal View History

"""
Installation
============
Using PIP
---------
Django MarkdownX may be installed directly using Python Package Index (PyPi):
.. code-block:: bash
python3 -m pip install django-markdownx
From the source
---------------
Should you wish to download and install it using the source code, you can do as follows:
Note
Make sure you have activated your virtual environment if you're using one.
We start off by downloading the source code from GitHub and navigate to the downloaded directory:
.. code-block:: bash
git clone https://github.com/adi-/django-markdownx.git
cd django-markdownx/
Install the package. You can replace ``python3`` with ``python`` or any of |Supported_versions_of_Python| if
you have multiple versions installed on your machine:
.. code-block:: bash
python3 setup.py install
.. |Supported_versions_of_Python| image:: https://img.shields.io/pypi/pyversions/django-markdownx.svg
"""
2014-11-03 09:00:53 +00:00
from setuptools import setup, find_packages
from os import environ, link
from os.path import join, dirname
from re import compile as re_compile
if 'vagrant' in str(environ):
del link
def get_meta():
values = {
'author',
'description',
'credits',
'copyright',
'license',
'maintainer',
'version'
}
# Constructing the parsing pattern for metadata:
template = str.join('|', values)
pattern = re_compile(
r"^_{{2}}"
r"(?P<name>({}))"
r"_{{2}}.+[\'\"]"
r"(?P<value>(.+))"
r"[\'\"][.\n]?$".format(template)
)
meta = dict()
# Parsing metadata from `./markdownx/__init__.py`:
path = join(dirname(__file__), 'markdownx', '__init__.py')
with open(path, 'r') as data:
for line in data:
if not line.startswith('__'):
continue
found = pattern.search(line)
if found is not None:
meta[found.group('name')] = found.group('value')
return meta
2015-09-06 21:15:36 +00:00
2015-09-29 19:50:26 +00:00
def get_requirements():
with open('requirements.txt') as requirements:
req = requirements.read().splitlines()
return req
metadata = get_meta()
2015-09-29 19:50:26 +00:00
2014-11-01 22:09:46 +00:00
setup(
name='django-markdownx',
version=metadata.get('version'),
2014-11-03 09:00:53 +00:00
packages=find_packages(),
author=metadata.get('author'),
maintainer=metadata.get('maintainer'),
2014-11-03 10:04:22 +00:00
include_package_data=True,
description=metadata.get('description'),
long_description=metadata.get('doc'),
2014-11-01 22:09:46 +00:00
url='https://github.com/adi-/django-markdownx',
license=metadata.get('license'),
2014-11-01 22:09:46 +00:00
classifiers=[
2015-09-06 19:34:05 +00:00
'Development Status :: 5 - Production/Stable',
2014-11-01 22:09:46 +00:00
'Environment :: Web Environment',
'Environment :: Plugins',
2016-08-17 19:53:03 +00:00
'Framework :: Django',
2016-05-14 19:59:59 +00:00
'Framework :: Django :: 1.8',
'Framework :: Django :: 1.9',
2016-08-15 11:36:29 +00:00
'Framework :: Django :: 1.10',
2014-11-01 22:09:46 +00:00
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
2016-05-14 20:03:26 +00:00
'Programming Language :: JavaScript',
2016-08-17 19:53:03 +00:00
'Programming Language :: Python',
2014-11-01 22:09:46 +00:00
'Programming Language :: Python :: 2.7',
2015-09-30 11:22:35 +00:00
'Programming Language :: Python :: 3.4',
2015-09-29 04:28:20 +00:00
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: JavaScript',
2016-08-17 19:53:03 +00:00
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Multimedia :: Graphics',
'Topic :: Text Processing :: Markup',
'Topic :: Text Editors :: Text Processing',
'Topic :: Text Editors :: Word Processors',
'Topic :: Text Processing :: Markup :: HTML',
'Topic :: Multimedia :: Graphics :: Presentation',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Site Management'
2014-11-01 22:09:46 +00:00
],
keywords='django markdown markdownx django-markdownx editor image upload drag&drop ajax',
2015-09-30 11:22:35 +00:00
tests_require=get_requirements(),
test_suite='runtests',
2015-09-29 19:50:26 +00:00
install_requires=get_requirements(),
2016-05-15 11:34:15 +00:00
2014-11-01 22:09:46 +00:00
)