diff --git a/fff_internals/cli.py b/fff_internals/cli.py index df899002..93aa9b4b 100644 --- a/fff_internals/cli.py +++ b/fff_internals/cli.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2014 Fanficdownloader team +# Copyright 2015 Fanficdownloader team # # Licensed under the Apache License, Version 2.0 (the 'License'); # you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ # from optparse import OptionParser -from os.path import expanduser, isfile, join +from os.path import expanduser, isfile, join, dirname from subprocess import call import ConfigParser import getpass @@ -25,7 +25,6 @@ import pprint import string import sys - if sys.version_info < (2, 5): print 'This program requires Python 2.5 or newer.' sys.exit(1) @@ -160,6 +159,9 @@ def main(argv=None, parser=None, passed_defaultsini=None, passed_personalini=Non if 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')): conflist.append(join(homepath, 'defaults.ini')) if isfile(join(homepath2, 'defaults.ini')): diff --git a/fff_internals/configurable.py b/fff_internals/configurable.py index dc30feae..a1f0fd2c 100644 --- a/fff_internals/configurable.py +++ b/fff_internals/configurable.py @@ -402,7 +402,7 @@ class Configuration(ConfigParser.SafeConfigParser): else: 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. # @@ -461,7 +461,9 @@ class Configuration(ConfigParser.SafeConfigParser): #raise MissingSectionHeaderError(fpname, lineno, line) # an option line? else: - mo = self._optcre.match(line) + mo = self.OPTCRE.match(line) # OPTCRE instead of + # _optcre so it works + # with python 2.6 if mo: optname, vi, optval = mo.group('option', 'vi', 'value') # This check is fine because the OPTCRE cannot diff --git a/defaults.ini b/fff_internals/defaults.ini similarity index 100% rename from defaults.ini rename to fff_internals/defaults.ini diff --git a/example.ini b/fff_internals/example.ini similarity index 100% rename from example.ini rename to fff_internals/example.ini diff --git a/makeplugin.py b/makeplugin.py index 4c4ca087..771f5bfc 100644 --- a/makeplugin.py +++ b/makeplugin.py @@ -44,11 +44,11 @@ if __name__=="__main__": files, exclude=exclude) - os.chdir('../cli') - # 'a' for append - createZipFile("../"+filename,"a", - ['downloader.py','defaults.ini'], - exclude=exclude) + # os.chdir('../cli') + # # 'a' for append + # createZipFile("../"+filename,"a", + # ['downloader.py','defaults.ini'], + # exclude=exclude) os.chdir('..') # 'a' for append diff --git a/setup.py b/setup.py index 6fe75572..ae274ca7 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ setup( # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # 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', long_description=long_description, @@ -69,18 +69,21 @@ setup( ], # 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 # simple. Or you can use find_packages(). # packages=find_packages(exclude=['contrib', 'docs', 'tests*']), 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 # your project is installed. For an analysis of "install_requires" vs pip's # requirements files see: # 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 # 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 # have to be included in MANIFEST.in as well. package_data={ - 'defaults.ini': ['defaults.ini'], - 'example.ini': ['example.ini'], + 'fff_internals': ['defaults.ini', 'example.ini'], }, # Although 'package_data' is the preferred approach, in some case you may