Version specific not.finished files, etc

`not.finished` files are now version specific, old `not.finished` files will simply not be loaded preventing any issues with feature changes that require new arguments.

Minimum Python version is now enforced properly, it should now be impossible to install (via `pip`) with an unsupported Python version.

Bandcamp-dl version is now located in setup.py only with it being added to a generated `__init__.py` during packaging or install.
master
Anthony Forsberg 2017-05-20 16:02:17 -04:00
parent 4413ad3ab2
commit c8680f2694
5 changed files with 18 additions and 7 deletions

View File

@ -59,15 +59,16 @@ from docopt import docopt
from bandcamp_dl.bandcamp import Bandcamp
from bandcamp_dl.bandcampdownloader import BandcampDownloader
from bandcamp_dl.__init__ import __version__
def main():
arguments = docopt(__doc__, version='bandcamp-dl 0.0.8-1')
arguments = docopt(__doc__, version='bandcamp-dl {}'.format(__version__))
bandcamp = Bandcamp()
basedir = arguments['--base-dir'] or os.getcwd()
session_file = basedir + "/not.finished"
session_file = "{}/{}.not.finished".format(basedir, __version__)
if os.path.isfile(session_file):
with open(session_file, "r") as f:

View File

@ -6,11 +6,12 @@ from bs4 import BeautifulSoup
from bs4 import FeatureNotFound
from bandcamp_dl.bandcampjson import BandcampJSON
from bandcamp_dl.__init__ import __version__
class Bandcamp:
def __init__(self):
self.headers = {'User-Agent': 'bandcamp-dl/0.0.8-02 (https://github.com/iheanyi/bandcamp-dl)'}
self.headers = {'User-Agent': 'bandcamp-dl/{} (https://github.com/iheanyi/bandcamp-dl)'.format(__version__)}
def parse(self, url: str, art: bool=True) -> dict or None:
"""Requests the page, cherry picks album info

View File

@ -13,6 +13,8 @@ if not sys.version_info[:2] == (3, 6):
import mock
from bandcamp_dl.utils import requests_patch
from bandcamp_dl.__init__ import __version__
class BandcampDownloader:
def __init__(self, urls=None, template=None, directory=None, overwrite=False, lyrics=None, grouping=None,
@ -24,7 +26,7 @@ class BandcampDownloader:
:param directory: download location
:param overwrite: if True overwrite existing files
"""
self.headers = {'User-Agent': 'bandcamp-dl/0.0.8-02 (https://github.com/iheanyi/bandcamp-dl)'}
self.headers = {'User-Agent': 'bandcamp-dl/{} (https://github.com/iheanyi/bandcamp-dl)'.format(__version__)}
self.session = requests.Session()
if type(urls) is str:

View File

@ -3,14 +3,21 @@ from codecs import open
from os import path
import sys
if sys.version_info[0] == 2:
sys.exit('Python 2 is unsupported.')
appversion = "0.0.8-03"
pyversion = int("{}{}".format(sys.version_info[0], sys.version_info[1]))
if not pyversion >= 34:
print('Python 3.4+ is required')
sys.exit(1)
here = path.abspath(path.dirname(__file__))
with open(here + '/bandcamp_dl/__init__.py', 'w') as initpy:
initpy.write('__version__ = "{}"'.format(appversion))
setup(
name='bandcamp-downloader',
version='0.0.8-02',
version=appversion,
description='bandcamp-dl downloads albums and tracks from Bandcamp for you',
long_description=open('README.rst').read(),
url='https://github.com/iheanyi/bandcamp-dl',