diff --git a/.python-version b/.python-version deleted file mode 100644 index e2d8f77..0000000 --- a/.python-version +++ /dev/null @@ -1,5 +0,0 @@ -3.3.6 -3.4.6 -3.5.3 -3.6.1 -jython-2.7.0 diff --git a/ffmpeg/nodes.py b/ffmpeg/nodes.py index c6359e2..11bec59 100644 --- a/ffmpeg/nodes.py +++ b/ffmpeg/nodes.py @@ -8,13 +8,13 @@ import json class Node(object): """Node base""" def __init__(self, parents, name, *args, **kwargs): - parent_hashes = [parent._hash for parent in parents] + parent_hashes = [hash(parent) for parent in parents] assert len(parent_hashes) == len(set(parent_hashes)), 'Same node cannot be included as parent multiple times' self._parents = parents + self._hash = None self._name = name self._args = args self._kwargs = kwargs - self._update_hash() def __repr__(self): formatted_props = ['{}'.format(arg) for arg in self._args] @@ -22,17 +22,22 @@ class Node(object): return '{}({})'.format(self._name, ','.join(formatted_props)) def __hash__(self): - return int(self._hash, base=16) + if self._hash is None: + self._update_hash() + return self._hash def __eq__(self, other): - return self._hash == other._hash + return hash(self) == hash(other) def _update_hash(self): props = {'args': self._args, 'kwargs': self._kwargs} - my_hash = hashlib.md5(json.dumps(props, sort_keys=True).encode('utf-8')).hexdigest() - parent_hashes = [parent._hash for parent in self._parents] + props_str = json.dumps(props, sort_keys=True).encode('utf-8') + my_hash = hashlib.md5(props_str).hexdigest() + parent_hashes = [str(hash(parent)) for parent in self._parents] hashes = parent_hashes + [my_hash] - self._hash = hashlib.md5(','.join(hashes).encode('utf-8')).hexdigest() + hashes_str = ','.join(hashes).encode('utf-8') + hash_str = hashlib.md5(hashes_str).hexdigest() + self._hash = int(hash_str, base=16) class InputNode(Node): diff --git a/setup.py b/setup.py index 0e11dab..409be5a 100644 --- a/setup.py +++ b/setup.py @@ -2,12 +2,8 @@ from setuptools import setup from textwrap import dedent import subprocess - -def get_current_commit_hash(): - p = subprocess.Popen(['git', 'rev-parse', 'HEAD'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - commit_hash = p.communicate()[0].strip() - return commit_hash - +version = '0.1.6' +download_url = 'https://github.com/kkroening/ffmpeg-python/archive/v{}.zip'.format(version) long_description = dedent("""\ ffmpeg-python: Python bindings for FFmpeg @@ -18,10 +14,6 @@ long_description = dedent("""\ """) - -commit_hash = get_current_commit_hash() -download_url = 'https://github.com/kkroening/ffmpeg-python/archive/{}.zip'.format(commit_hash) - file_formats = [ 'aac', 'ac3', @@ -67,7 +59,7 @@ setup( packages=['ffmpeg'], setup_requires=['pytest-runner'], tests_require=['pytest'], - version='0.1.5', + version=version, description='Python bindings for FFmpeg - with support for complex filtering', author='Karl Kroening', author_email='karlk@kralnet.us',