add version.py
This commit is contained in:
parent
541f09d575
commit
7f8a611b23
3 changed files with 14 additions and 6 deletions
14
setup.py
14
setup.py
|
@ -6,14 +6,15 @@
|
|||
import os
|
||||
import sys
|
||||
import platform
|
||||
import glob
|
||||
import codecs
|
||||
import re
|
||||
|
||||
try:
|
||||
from setuptools import setup, Extension
|
||||
except ImportError:
|
||||
from distutils.core import setup, Extension
|
||||
|
||||
import glob
|
||||
|
||||
try:
|
||||
import Cython.Compiler.Main as cython_compiler
|
||||
|
||||
|
@ -63,6 +64,15 @@ cchardet_module = Extension(
|
|||
def read(f):
|
||||
return open(os.path.join(os.path.dirname(__file__), f)).read().strip()
|
||||
|
||||
|
||||
with codecs.open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'src', 'cchardet', 'version.py'), 'r',
|
||||
'latin1') as fp:
|
||||
try:
|
||||
version = re.findall(r"^__version__ = '([^']+)'\r?$",
|
||||
fp.read(), re.M)[0]
|
||||
except IndexError:
|
||||
raise RuntimeError('Unable to determine version.')
|
||||
|
||||
setup(
|
||||
name='cchardet',
|
||||
author='PyYoshi',
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# coding: utf-8
|
||||
|
||||
from cchardet import _cchardet
|
||||
|
||||
from .version import __version__
|
||||
|
||||
def detect(msg):
|
||||
"""
|
||||
|
|
1
src/cchardet/version.py
Normal file
1
src/cchardet/version.py
Normal file
|
@ -0,0 +1 @@
|
|||
__version__ = '1.1.0'
|
Loading…
Reference in a new issue