debian-django-ckeditor/setup.py

81 lines
2.7 KiB
Python
Raw Permalink Normal View History

2018-11-05 12:48:45 +01:00
import os
2012-05-27 17:07:53 +02:00
import os.path
2018-11-05 12:48:45 +01:00
import subprocess
from setuptools import setup, find_packages
2018-11-05 12:48:45 +01:00
from distutils.command.sdist import sdist
class eo_sdist(sdist):
def run(self):
if os.path.exists('VERSION'):
os.remove('VERSION')
version = get_version()
version_file = open('VERSION', 'w')
version_file.write(version)
version_file.close()
sdist.run(self)
if os.path.exists('VERSION'):
os.remove('VERSION')
def get_version():
'''Use the VERSION, if absent generates a version with git describe, if not
tag exists, take 0.0- and add the length of the commit log.
'''
if os.path.exists('VERSION'):
with open('VERSION', 'r') as v:
return v.read()
if os.path.exists('.git'):
p = subprocess.Popen(['git','describe','--dirty=.dirty','--match=v*'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = p.communicate()[0]
if p.returncode == 0:
result = result.decode('ascii').strip()[1:] # strip spaces/newlines and initial v
if '-' in result: # not a tagged version
real_number, commit_count, commit_hash = result.split('-', 2)
version = '%s.post%s+%s' % (real_number, commit_count, commit_hash)
else:
version = result
return version
else:
return '0.0.post%s' % len(
subprocess.check_output(
['git', 'rev-list', 'HEAD']).splitlines())
return '0.0'
2010-03-08 20:27:14 +01:00
2013-04-04 08:15:56 +02:00
2012-05-27 17:07:53 +02:00
def get_source_files():
for dirname, _, files in os.walk('ckeditor/static/ckeditor/ckeditor/_source'):
for filename in files:
yield os.path.join('/'.join(dirname.split('/')[1:]), filename)
2010-03-08 20:27:14 +01:00
setup(
2014-09-10 15:34:09 +02:00
name='django-ckeditor',
2018-11-05 12:48:45 +01:00
version=get_version(),
2010-03-31 17:31:37 +02:00
description='Django admin CKEditor integration.',
2013-04-04 08:15:56 +02:00
long_description=open('README.rst', 'r').read() + open('AUTHORS.rst', 'r').read() + open('CHANGELOG.rst', 'r').read(),
author='Shaun Sephton & Piotr Malinski',
author_email='riklaunim@gmail.com',
2015-07-07 20:33:50 +02:00
url='https://github.com/django-ckeditor/django-ckeditor',
packages=find_packages(exclude=["*.demo"]),
2013-04-04 08:15:56 +02:00
install_requires=[
2013-11-15 23:54:39 +01:00
'Django',
2010-06-24 18:26:00 +02:00
],
include_package_data=True,
2011-08-30 12:31:21 +02:00
classifiers=[
2010-05-29 10:08:14 +02:00
"Programming Language :: Python",
2013-11-15 15:30:53 +01:00
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.3",
2014-06-01 01:01:20 +02:00
"Programming Language :: Python :: 3.4",
2010-05-29 10:08:14 +02:00
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
2010-05-30 09:28:05 +02:00
"Framework :: Django",
2010-05-29 10:08:14 +02:00
"Intended Audience :: Developers",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
],
2018-11-05 12:48:45 +01:00
cmdclass={
'sdist': eo_sdist,
},
zip_safe=False,
2010-03-08 20:27:14 +01:00
)