Skip to content

Commit 15becc9

Browse files
committed
Relocated VERSION into flake8_quotes/__about__.py
1 parent 6b5eb0e commit 15becc9

File tree

6 files changed

+22
-17
lines changed

6 files changed

+22
-17
lines changed

MANIFEST.in

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
include LICENSE
2-
include VERSION
3-
include tox.ini
42

3+
recursive-include flake8_quotes *.py
54
recursive-include test *.py
6-
7-
exclude release.sh

VERSION

-1
This file was deleted.

flake8_quotes/__about__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '0.2.3'

flake8_quotes.py flake8_quotes/__init__.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import os
21
import tokenize
32

43
import pep8
54

6-
7-
with open(os.path.join(os.path.dirname(__file__), 'VERSION'), 'r') as handle:
8-
__version__ = handle.read().strip()
5+
from flake8_quotes.__about__ import __version__
96

107

118
class QuoteChecker(object):

release.sh

+9-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ if test "$version" = ""; then
1010
exit 1
1111
fi
1212

13-
# All references to a version number are derived from this file.
14-
echo "$version" > VERSION
13+
# Bump the version via regexp
14+
sed -E "s/^(__version__ = ')[0-9]+\.[0-9]+\.[0-9]+(')$/\1$version\2/" flake8_quotes/__about__.py --in-place
15+
16+
# Verify our version made it into the file
17+
if ! grep "$version" flake8_quotes/__about__.py &> /dev/null; then
18+
echo "Expected \`__version__\` to update via \`sed\` but it didn't" 1>&2
19+
exit 1
20+
fi
1521

1622
# Commit the change
17-
git add flake8_quotes.py
23+
git add flake8_quotes/__about__.py
1824
git commit -a -m "Release $version"
1925

2026
# Tag the release

setup.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import io
2+
import os
23
from setuptools import setup
34

5+
__dir__ = os.path.dirname(__file__)
6+
47

58
def read(*filenames, **kwargs):
69
encoding = kwargs.get('encoding', 'utf-8')
@@ -12,23 +15,25 @@ def read(*filenames, **kwargs):
1215
return sep.join(buf)
1316

1417

15-
LONG_DESCRIPTION = read('README.rst')
16-
VERSION = read('VERSION').strip()
18+
LONG_DESCRIPTION = read(os.path.join(__dir__, 'README.rst'))
19+
20+
about = {}
21+
with open(os.path.join(__dir__, 'flake8_quotes', '__about__.py')) as file:
22+
exec(file.read(), about)
1723

1824

1925
setup(
2026
name='flake8-quotes',
2127
author='Zachary Wright Heller',
2228
author_email='zheller@gmail.com',
23-
version=VERSION,
29+
version=about['__version__'],
2430
install_requires=[
2531
'pep8',
26-
'setuptools',
2732
],
2833
url='http://github.com/zheller/flake8-quotes/',
2934
long_description=LONG_DESCRIPTION,
3035
description='Flake8 lint for quotes.',
31-
py_modules=['flake8_quotes'],
36+
packages=['flake8_quotes'],
3237
test_suite='test',
3338
include_package_data=True,
3439
entry_points={

0 commit comments

Comments
 (0)