Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save scorphus/b110f3ac1fb897ec7b4aecb01ae250c8 to your computer and use it in GitHub Desktop.
Save scorphus/b110f3ac1fb897ec7b4aecb01ae250c8 to your computer and use it in GitHub Desktop.
Patches
diff --git a/setup.py b/setup.py
index 4e6d848..b20b920 100644
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,7 @@ with open(os.path.join(_BASE_DIR, 'README.md')) as readme_file:
setup(
name='boilerpy3',
version=__version__,
- python_requires='>=3.6.*',
+ python_requires='>=3.6',
author='John Riebold',
author_email='jmriebold@gmail.com',
license='Apache 2.0',
diff --git a/requirements_classifier.txt b/requirements_classifier.txt
new file mode 100644
index 00000000000..826dbc3ae90
--- /dev/null
+++ b/requirements_classifier.txt
@@ -0,0 +1,6 @@
+numpy
+scipy
+scikit-learn
+joblib
+wikipedia
+stemming
\ No newline at end of file
diff --git a/version.py b/version.py
new file mode 100644
index 00000000000..3e845c90e47
--- /dev/null
+++ b/version.py
@@ -0,0 +1,72 @@
+# This program is placed into the public domain.
+
+"""
+Gets the current version number.
+If in a git repository, it is the current git tag.
+Otherwise it is the one contained in the PKG-INFO file.
+
+To use this script, simply import it in your setup.py file
+and use the results of get_version() as your package version:
+
+ from version import *
+
+ setup(
+ ...
+ version=get_version(),
+ ...
+ )
+"""
+
+__all__ = ('get_version')
+
+from os.path import dirname, isdir, join
+import os
+import re
+import subprocess
+
+version_re = re.compile('^Version: (.+)$', re.M)
+
+
+def get_version():
+ d = dirname(__file__)
+
+ if isdir(join(d, '.git')):
+ # Get the version using "git describe".
+ cmd = 'git describe --tags --match [0-9]*'.split()
+ try:
+ version = subprocess.check_output(cmd).decode().strip()
+ except subprocess.CalledProcessError:
+ print('Unable to get version number from git tags')
+ exit(1)
+
+ # PEP 386 compatibility
+ if '-' in version:
+ version = '.post'.join(version.split('-')[:2])
+
+ # Don't declare a version "dirty" merely because a time stamp has
+ # changed. If it is dirty, append a ".dev1" suffix to indicate a
+ # development revision after the release.
+ with open(os.devnull, 'w') as fd_devnull:
+ subprocess.call(['git', 'status'],
+ stdout=fd_devnull, stderr=fd_devnull)
+
+ cmd = 'git diff-index --name-only HEAD'.split()
+ try:
+ dirty = subprocess.check_output(cmd).decode().strip()
+ except subprocess.CalledProcessError:
+ print('Unable to get git index status')
+ exit(1)
+
+ if dirty != '':
+ version += '.dev1'
+
+ else:
+ # Extract the version from the PKG-INFO file.
+ with open(join(d, 'PKG-INFO')) as f:
+ version = version_re.search(f.read()).group(1)
+
+ return version
+
+
+if __name__ == '__main__':
+ print(get_version())
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment