mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
restructure the whole way scripts are created, using setuptools magic
to take care of creating .exe wrappers for windows. To make this work needed to - rename modules with a "-" in it (not a valid name) - add an __init__.py to the tools directory - create an entry point dictionary which stores the right associations
This commit is contained in:
parent
1f32624e8b
commit
8009324a3b
11 changed files with 782 additions and 786 deletions
17
setup.py
17
setup.py
|
|
@ -12,13 +12,14 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
requires.append('argparse')
|
requires.append('argparse')
|
||||||
|
|
||||||
scripts = ['bin/pelican', 'tools/pelican-themes', 'tools/pelican-import', 'tools/pelican-quickstart']
|
entry_points = {
|
||||||
|
'console_scripts': [
|
||||||
if sys.platform.startswith('win'):
|
'pelican = pelican:main',
|
||||||
scripts += [
|
'pelican-import = tools.pelican_import:main',
|
||||||
'bin/pelican.bat', 'tools/pelican-themes.bat',
|
'pelican-quickstart = tools.pelican_quickstart:main',
|
||||||
'tools/pelican-import.bat', 'tools/pelican-quickstart.bat'
|
'pelican-themes = tools.pelican_themes:main'
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = "pelican",
|
name = "pelican",
|
||||||
|
|
@ -31,7 +32,7 @@ setup(
|
||||||
packages = ['pelican'],
|
packages = ['pelican'],
|
||||||
include_package_data = True,
|
include_package_data = True,
|
||||||
install_requires = requires,
|
install_requires = requires,
|
||||||
scripts = scripts,
|
entry_points = entry_points,
|
||||||
classifiers = ['Development Status :: 5 - Production/Stable',
|
classifiers = ['Development Status :: 5 - Production/Stable',
|
||||||
'Environment :: Console',
|
'Environment :: Console',
|
||||||
'License :: OSI Approved :: GNU Affero General Public License v3',
|
'License :: OSI Approved :: GNU Affero General Public License v3',
|
||||||
|
|
|
||||||
0
tools/__init__.py
Normal file
0
tools/__init__.py
Normal file
|
|
@ -1 +0,0 @@
|
||||||
@python "%~dpn0" %*
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
@python "%~dpn0" %*
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
@python "%~dpn0" %*
|
|
||||||
|
|
@ -231,18 +231,7 @@ def fields2pelican(fields, out_markup, output_path, dircat=False):
|
||||||
fs.write(header + content)
|
fs.write(header + content)
|
||||||
|
|
||||||
|
|
||||||
def main(input_type, input, out_markup, output_path, dircat=False):
|
def main():
|
||||||
if input_type == 'wordpress':
|
|
||||||
fields = wp2fields(input)
|
|
||||||
elif input_type == 'dotclear':
|
|
||||||
fields = dc2fields(input)
|
|
||||||
elif input_type == 'feed':
|
|
||||||
fields = feed2fields(input)
|
|
||||||
|
|
||||||
fields2pelican(fields, out_markup, output_path, dircat=dircat)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="Transform feed, Wordpress or Dotclear files to rst files."
|
description="Transform feed, Wordpress or Dotclear files to rst files."
|
||||||
"Be sure to have pandoc installed")
|
"Be sure to have pandoc installed")
|
||||||
|
|
@ -280,4 +269,13 @@ if __name__ == '__main__':
|
||||||
error("Couldn't create the output folder: " + args.output)
|
error("Couldn't create the output folder: " + args.output)
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
main(input_type, args.input, args.markup, args.output, dircat=args.dircat)
|
input_type, input, out_markup, output_path, dircat=False = input_type, args.input, args.markup, args.output, args.dircat
|
||||||
|
|
||||||
|
if input_type == 'wordpress':
|
||||||
|
fields = wp2fields(input)
|
||||||
|
elif input_type == 'dotclear':
|
||||||
|
fields = dc2fields(input)
|
||||||
|
elif input_type == 'feed':
|
||||||
|
fields = feed2fields(input)
|
||||||
|
|
||||||
|
fields2pelican(fields, out_markup, output_path, dircat=dircat)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue