mirror of
https://github.com/Hopiu/django-model-utils.git
synced 2026-03-16 20:00:23 +00:00
Fix unclosed file handles in setup.py.
This commit is contained in:
parent
d131735e4f
commit
0e5c42377f
2 changed files with 15 additions and 11 deletions
4
TODO.rst
4
TODO.rst
|
|
@ -1,4 +0,0 @@
|
|||
TODO
|
||||
====
|
||||
|
||||
* Switch to proper test skips once Django 1.3 is minimum supported.
|
||||
22
setup.py
22
setup.py
|
|
@ -1,21 +1,29 @@
|
|||
from os.path import join
|
||||
import os
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
|
||||
long_description = (open('README.rst').read() +
|
||||
open('CHANGES.rst').read() +
|
||||
open('TODO.rst').read())
|
||||
def long_desc(root_path):
|
||||
FILES = ['README.rst', 'CHANGES.rst']
|
||||
for filename in FILES:
|
||||
filepath = os.path.realpath(os.path.join(root_path, filename))
|
||||
if os.path.isfile(filepath):
|
||||
with open(filepath, mode='r') as f:
|
||||
yield f.read()
|
||||
|
||||
|
||||
def get_version():
|
||||
with open(join('model_utils', '__init__.py')) as f:
|
||||
HERE = os.path.abspath(os.path.dirname(__file__))
|
||||
long_description = "\n\n".join(long_desc(HERE))
|
||||
|
||||
|
||||
def get_version(root_path):
|
||||
with open(os.path.join(root_path, 'model_utils', '__init__.py')) as f:
|
||||
for line in f:
|
||||
if line.startswith('__version__ ='):
|
||||
return line.split('=')[1].strip().strip('"\'')
|
||||
|
||||
setup(
|
||||
name='django-model-utils',
|
||||
version=get_version(),
|
||||
version=get_version(HERE),
|
||||
description='Django model mixins and utilities',
|
||||
long_description=long_description,
|
||||
author='Carl Meyer',
|
||||
|
|
|
|||
Loading…
Reference in a new issue