A fork of hyde, the static site generation. Some patches will be pushed upstream.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

180 lines
6.1 KiB

  1. # Bootstrap installation of Distribute
  2. import distribute_setup
  3. distribute_setup.use_setuptools()
  4. from setuptools import setup, find_packages
  5. from hyde.version import __version__
  6. from distutils.util import convert_path
  7. from fnmatch import fnmatchcase
  8. import os
  9. import sys
  10. PROJECT = 'hyde'
  11. try:
  12. import markdown
  13. except:
  14. markdown = False
  15. try:
  16. long_description = open('README.markdown', 'rt').read()
  17. if markdown:
  18. long_description = markdown.markdown(long_description)
  19. import re
  20. long_description = re.sub('(.*)', ' \\1', long_description)
  21. long_description ='.. raw:: html\n\n' + long_description
  22. except IOError:
  23. long_description = ''
  24. ################################################################################
  25. # find_package_data is an Ian Bicking creation.
  26. # Provided as an attribute, so you can append to these instead
  27. # of replicating them:
  28. standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
  29. standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
  30. './dist', 'EGG-INFO', '*.egg-info')
  31. def find_package_data(
  32. where='.', package='',
  33. exclude=standard_exclude,
  34. exclude_directories=standard_exclude_directories,
  35. only_in_packages=True,
  36. show_ignored=False):
  37. """
  38. Return a dictionary suitable for use in ``package_data``
  39. in a distutils ``setup.py`` file.
  40. The dictionary looks like::
  41. {'package': [files]}
  42. Where ``files`` is a list of all the files in that package that
  43. don't match anything in ``exclude``.
  44. If ``only_in_packages`` is true, then top-level directories that
  45. are not packages won't be included (but directories under packages
  46. will).
  47. Directories matching any pattern in ``exclude_directories`` will
  48. be ignored; by default directories with leading ``.``, ``CVS``,
  49. and ``_darcs`` will be ignored.
  50. If ``show_ignored`` is true, then all the files that aren't
  51. included in package data are shown on stderr (for debugging
  52. purposes).
  53. Note patterns use wildcards, or can be exact paths (including
  54. leading ``./``), and all searching is case-insensitive.
  55. This function is by Ian Bicking.
  56. """
  57. out = {}
  58. stack = [(convert_path(where), '', package, only_in_packages)]
  59. while stack:
  60. where, prefix, package, only_in_packages = stack.pop(0)
  61. for name in os.listdir(where):
  62. fn = os.path.join(where, name)
  63. if os.path.isdir(fn):
  64. bad_name = False
  65. for pattern in exclude_directories:
  66. if (fnmatchcase(name, pattern)
  67. or fn.lower() == pattern.lower()):
  68. bad_name = True
  69. if show_ignored:
  70. print >> sys.stderr, (
  71. "Directory %s ignored by pattern %s"
  72. % (fn, pattern))
  73. break
  74. if bad_name:
  75. continue
  76. if os.path.isfile(os.path.join(fn, '__init__.py')):
  77. if not package:
  78. new_package = name
  79. else:
  80. new_package = package + '.' + name
  81. stack.append((fn, '', new_package, False))
  82. else:
  83. stack.append((fn, prefix + name + '/', package, only_in_packages))
  84. elif package or not only_in_packages:
  85. # is a file
  86. bad_name = False
  87. for pattern in exclude:
  88. if (fnmatchcase(name, pattern)
  89. or fn.lower() == pattern.lower()):
  90. bad_name = True
  91. if show_ignored:
  92. print >> sys.stderr, (
  93. "File %s ignored by pattern %s"
  94. % (fn, pattern))
  95. break
  96. if bad_name:
  97. continue
  98. out.setdefault(package, []).append(prefix+name)
  99. return out
  100. ################################################################################
  101. setup(name=PROJECT,
  102. version=__version__,
  103. description='hyde is a static website generator',
  104. long_description = long_description,
  105. author='Lakshmi Vyas',
  106. author_email='lakshmi.vyas@gmail.com',
  107. url='http://ringce.com/hyde',
  108. packages=find_packages(),
  109. dependency_links=[
  110. "https://github.com/hyde/typogrify/tarball/hyde-setup#egg=typogrify-hyde"
  111. ],
  112. install_requires=(
  113. 'argparse',
  114. 'commando',
  115. 'jinja2',
  116. 'pyYAML',
  117. 'markdown',
  118. 'smartypants',
  119. 'pygments',
  120. 'typogrify-hyde'
  121. ),
  122. tests_require=(
  123. 'nose',
  124. ),
  125. test_suite='nose.collector',
  126. include_package_data = True,
  127. # Scan the input for package information
  128. # to grab any data files (text, images, etc.)
  129. # associated with sub-packages.
  130. package_data = find_package_data(PROJECT,
  131. package=PROJECT,
  132. only_in_packages=False,
  133. ),
  134. scripts=['main.py'],
  135. entry_points={
  136. 'console_scripts': [
  137. 'hyde = main:main'
  138. ]
  139. },
  140. license='MIT',
  141. classifiers=[
  142. 'Development Status :: 4 - Beta',
  143. 'Environment :: Console',
  144. 'Intended Audience :: End Users/Desktop',
  145. 'Intended Audience :: Developers',
  146. 'Intended Audience :: System Administrators',
  147. 'License :: OSI Approved :: MIT License',
  148. 'Operating System :: MacOS :: MacOS X',
  149. 'Operating System :: Unix',
  150. 'Operating System :: POSIX',
  151. 'Operating System :: Microsoft :: Windows',
  152. 'Programming Language :: Python',
  153. 'Topic :: Software Development',
  154. 'Topic :: Software Development :: Build Tools',
  155. 'Topic :: Software Development :: Code Generators',
  156. 'Topic :: Internet',
  157. 'Topic :: Internet :: WWW/HTTP :: Site Management',
  158. ],
  159. zip_safe=False,
  160. )