Fix defaults.ini for CLI pip install.

This commit is contained in:
Jim Miller 2015-04-08 13:33:12 -05:00
parent 47c1b45b9c
commit fbffee6cb5
6 changed files with 21 additions and 15 deletions

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2014 Fanficdownloader team # Copyright 2015 Fanficdownloader team
# #
# Licensed under the Apache License, Version 2.0 (the 'License'); # Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -16,7 +16,7 @@
# #
from optparse import OptionParser from optparse import OptionParser
from os.path import expanduser, isfile, join from os.path import expanduser, isfile, join, dirname
from subprocess import call from subprocess import call
import ConfigParser import ConfigParser
import getpass import getpass
@ -25,7 +25,6 @@ import pprint
import string import string
import sys import sys
if sys.version_info < (2, 5): if sys.version_info < (2, 5):
print 'This program requires Python 2.5 or newer.' print 'This program requires Python 2.5 or newer.'
sys.exit(1) sys.exit(1)
@ -160,6 +159,9 @@ def main(argv=None, parser=None, passed_defaultsini=None, passed_personalini=Non
if passed_defaultsini: if passed_defaultsini:
configuration.readfp(passed_defaultsini) configuration.readfp(passed_defaultsini)
if isfile(join(dirname(__file__), 'defaults.ini')):
conflist.append(join(dirname(__file__), 'defaults.ini'))
if isfile(join(homepath, 'defaults.ini')): if isfile(join(homepath, 'defaults.ini')):
conflist.append(join(homepath, 'defaults.ini')) conflist.append(join(homepath, 'defaults.ini'))
if isfile(join(homepath2, 'defaults.ini')): if isfile(join(homepath2, 'defaults.ini')):

View file

@ -402,7 +402,7 @@ class Configuration(ConfigParser.SafeConfigParser):
else: else:
return self.linenos.get(section,None) return self.linenos.get(section,None)
## Copied from Python library so as to make it save linenos too. ## Copied from Python 2.7 library so as to make it save linenos too.
# #
# Regular expressions for parsing section headers and options. # Regular expressions for parsing section headers and options.
# #
@ -461,7 +461,9 @@ class Configuration(ConfigParser.SafeConfigParser):
#raise MissingSectionHeaderError(fpname, lineno, line) #raise MissingSectionHeaderError(fpname, lineno, line)
# an option line? # an option line?
else: else:
mo = self._optcre.match(line) mo = self.OPTCRE.match(line) # OPTCRE instead of
# _optcre so it works
# with python 2.6
if mo: if mo:
optname, vi, optval = mo.group('option', 'vi', 'value') optname, vi, optval = mo.group('option', 'vi', 'value')
# This check is fine because the OPTCRE cannot # This check is fine because the OPTCRE cannot

View file

@ -44,11 +44,11 @@ if __name__=="__main__":
files, files,
exclude=exclude) exclude=exclude)
os.chdir('../cli') # os.chdir('../cli')
# 'a' for append # # 'a' for append
createZipFile("../"+filename,"a", # createZipFile("../"+filename,"a",
['downloader.py','defaults.ini'], # ['downloader.py','defaults.ini'],
exclude=exclude) # exclude=exclude)
os.chdir('..') os.chdir('..')
# 'a' for append # 'a' for append

View file

@ -25,7 +25,7 @@ setup(
# Versions should comply with PEP440. For a discussion on single-sourcing # Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see # the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html # https://packaging.python.org/en/latest/single_source_version.html
version="2.2.0.dev6", version="2.2.0.dev8",
description='A tool for downloading fanfiction to eBook formats', description='A tool for downloading fanfiction to eBook formats',
long_description=long_description, long_description=long_description,
@ -69,18 +69,21 @@ setup(
], ],
# What does your project relate to? # What does your project relate to?
keywords='fanfiction download ebook epub', keywords='fanfiction download ebook epub html',
# You can just specify the packages manually here if your project is # You can just specify the packages manually here if your project is
# simple. Or you can use find_packages(). # simple. Or you can use find_packages().
# packages=find_packages(exclude=['contrib', 'docs', 'tests*']), # packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
packages=['fff_internals', 'fff_internals.adapters', 'fff_internals.writers'], packages=['fff_internals', 'fff_internals.adapters', 'fff_internals.writers'],
# for package_data
package_dir={'fff_internals': 'fff_internals'},
# List run-time dependencies here. These will be installed by pip when # List run-time dependencies here. These will be installed by pip when
# your project is installed. For an analysis of "install_requires" vs pip's # your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see: # requirements files see:
# https://packaging.python.org/en/latest/requirements.html # https://packaging.python.org/en/latest/requirements.html
install_requires=['beautifulsoup4','chardet','six','html5lib'], install_requires=['beautifulsoup4','chardet','html5lib'], # html5lib requires 'six'.
# List additional groups of dependencies here (e.g. development # List additional groups of dependencies here (e.g. development
# dependencies). You can install these using the following syntax, # dependencies). You can install these using the following syntax,
@ -95,8 +98,7 @@ setup(
# installed, specify them here. If using Python 2.6 or less, then these # installed, specify them here. If using Python 2.6 or less, then these
# have to be included in MANIFEST.in as well. # have to be included in MANIFEST.in as well.
package_data={ package_data={
'defaults.ini': ['defaults.ini'], 'fff_internals': ['defaults.ini', 'example.ini'],
'example.ini': ['example.ini'],
}, },
# Although 'package_data' is the preferred approach, in some case you may # Although 'package_data' is the preferred approach, in some case you may