commit f6886a5a95e99a23b2f3fa2cc99fba2efb259623
parent 62d0aab26d8473e3da389282e59ff4c1d39578d6
Author: ng0 <ng0@n0.is>
Date: Sat, 2 Dec 2017 12:43:29 +0000
layout changes
* move extract.py as it is an example -> examples/extract.py
* create 'libextractor' package and use it in the setup.py,
move extractor.py to the package folder and init the package.
Diffstat:
5 files changed, 49 insertions(+), 49 deletions(-)
diff --git a/examples/extract.py b/examples/extract.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+"""extract.py
+
+ This file is part of libextractor.
+ (C) 2002, 2003, 2004, 2005 Vidyut Samanta and Christian Grothoff
+ (C) 2017 ng0 <ng0@n0.is>
+
+ libextractor is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ libextractor is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with libextractor; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+Little demo how to use the libextractor Python binding.
+
+"""
+from __future__ import print_function
+from libextractor import extractor
+import sys
+from ctypes import *
+import struct
+
+xtract = extractor.Extractor()
+
+def print_k(xt, plugin, type, format, mime, data, datalen):
+ mstr = cast (data, c_char_p)
+# FIXME: this ignores 'datalen', not that great...
+# (in general, depending on the mime type and format, only
+# the first 'datalen' bytes in 'data' should be used).
+ if (format == extractor.EXTRACTOR_METAFORMAT_UTF8):
+ print("%s - %s" % (xtract.keywordTypes()[type], mstr.value))
+ return 0
+
+
+for arg in sys.argv[1:]:
+ print("Keywords from %s:" % arg)
+ xtract.extract(print_k, None, arg)
+
diff --git a/extract.py b/extract.py
@@ -1,47 +0,0 @@
-#!/usr/bin/env python
-"""extract.py
-
- This file is part of libextractor.
- (C) 2002, 2003, 2004, 2005 Vidyut Samanta and Christian Grothoff
- (C) 2017 ng0 <ng0@n0.is>
-
- libextractor is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
-
- libextractor is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with libextractor; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
-Little demo how to use the libextractor Python binding.
-
-"""
-from __future__ import print_function
-import extractor
-import sys
-from ctypes import *
-import struct
-
-xtract = extractor.Extractor()
-
-def print_k(xt, plugin, type, format, mime, data, datalen):
- mstr = cast (data, c_char_p)
-# FIXME: this ignores 'datalen', not that great...
-# (in general, depending on the mime type and format, only
-# the first 'datalen' bytes in 'data' should be used).
- if (format == extractor.EXTRACTOR_METAFORMAT_UTF8):
- print("%s - %s" % (xtract.keywordTypes()[type], mstr.value))
- return 0
-
-
-for arg in sys.argv[1:]:
- print("Keywords from %s:" % arg)
- xtract.extract(print_k, None, arg)
-
diff --git a/libextractor/__init__.py b/libextractor/__init__.py
diff --git a/extractor.py b/libextractor/extractor.py
diff --git a/setup.py b/setup.py
@@ -8,8 +8,8 @@ setup(
name = "Extractor",
version = "0.6",
- py_modules = ['extractor'],
- scripts = ['extract.py'],
+ packages = ['libextractor'],
+ scripts = ['examples/extract.py'],
#install_requires = ['ctypes >= 0.9'],