]> git.phdru.name Git - m_lib.defenc.git/commitdiff
Split defenc.py from m_lib into a separate namespace package
authorOleg Broytman <phd@phdru.name>
Sun, 16 Apr 2017 11:58:41 +0000 (14:58 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 16 Apr 2017 11:58:41 +0000 (14:58 +0300)
.gitignore [new file with mode: 0644]
MANIFEST.in [new file with mode: 0644]
Makefile [new file with mode: 0644]
README.txt [new file with mode: 0644]
m_lib/__init__.py [new file with mode: 0644]
m_lib/defenc.py [new file with mode: 0755]
mk-distr [new file with mode: 0755]
requirements.txt [new file with mode: 0644]
setup.cfg [new file with mode: 0644]
setup.py [new file with mode: 0755]
update [new file with mode: 0755]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..539da74
--- /dev/null
@@ -0,0 +1 @@
+*.py[co]
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644 (file)
index 0000000..858f5e2
--- /dev/null
@@ -0,0 +1,2 @@
+global-include *.py *.txt
+include MANIFEST.in Makefile mk-distr
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..89ab254
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,8 @@
+
+.PHONY: distr
+distr:
+       ./mk-distr
+
+.PHONY: clean
+clean:
+       find . -name '*.py[co]' -type f -delete
diff --git a/README.txt b/README.txt
new file mode 100644 (file)
index 0000000..887eefb
--- /dev/null
@@ -0,0 +1,7 @@
+Broytman Library for Python, Copyright (C) 1996-2017 PhiloSoft Design
+Author: Oleg Broytman <phd@phdru.name>
+License: GPL
+
+Content of the namespace pakage:
+
+defenc.py - get default encoding.
diff --git a/m_lib/__init__.py b/m_lib/__init__.py
new file mode 100644 (file)
index 0000000..bdbd21e
--- /dev/null
@@ -0,0 +1,5 @@
+"""Broytman Library for Python, Copyright (C) 1996-2017 PhiloSoft Design"""
+
+from pkgutil import extend_path
+__path__ = extend_path(__path__, __name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/m_lib/defenc.py b/m_lib/defenc.py
new file mode 100755 (executable)
index 0000000..776b78d
--- /dev/null
@@ -0,0 +1,37 @@
+#! /usr/bin/env python
+"""Get default encoding"""
+
+from __future__ import print_function
+import sys
+
+try:
+   import locale
+   use_locale = True
+except ImportError:
+   use_locale = False
+
+__all__ = ['default_encoding']
+
+if use_locale:
+   # Get the default charset.
+   try:
+      lcAll = locale.getdefaultlocale()
+   except locale.Error as err:
+      print("WARNING:", err, file=sys.stderr)
+      lcAll = []
+
+   if len(lcAll) == 2 and lcAll[0] is not None:
+      default_encoding = lcAll[1]
+   else:
+      try:
+         default_encoding = locale.getpreferredencoding()
+      except locale.Error as err:
+         print("WARNING:", err, file=sys.stderr)
+         default_encoding = sys.getdefaultencoding()
+else:
+   default_encoding = sys.getdefaultencoding()
+
+default_encoding = default_encoding.lower()
+
+if __name__ == "__main__":
+   print(default_encoding)
diff --git a/mk-distr b/mk-distr
new file mode 100755 (executable)
index 0000000..011aeeb
--- /dev/null
+++ b/mk-distr
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+umask 022 &&
+
+git archive --format=tar --prefix=m_lib.defenc/ "${1:-HEAD}" |
+   (cd "$HOME/tmp" && exec tar xf -) &&
+
+cd "$HOME/tmp/m_lib.defenc" &&
+python setup.py sdist --formats=bztar &&
+cd dist && mv m_lib.defenc-*.tar.bz2 ../.. && cd ../.. && exec rm -rf m_lib.defenc
diff --git a/requirements.txt b/requirements.txt
new file mode 100644 (file)
index 0000000..a93f011
--- /dev/null
@@ -0,0 +1,3 @@
+--trusted-host phdru.name
+--find-links=http://phdru.name/Software/Python/
+--install-option=-O2
diff --git a/setup.cfg b/setup.cfg
new file mode 100644 (file)
index 0000000..56a3566
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,9 @@
+[easy_install]
+find_links = http://phdru.name/Software/Python/
+optimize = 2
+
+[egg_info]
+tag_build = 
+tag_date = 0
+tag_svn_revision = 0
+
diff --git a/setup.py b/setup.py
new file mode 100755 (executable)
index 0000000..e15eacb
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,35 @@
+#! /usr/bin/env python
+
+try:
+    from setuptools import setup
+    is_setuptools = True
+except ImportError:
+    from distutils.core import setup
+    is_setuptools = False
+
+setup(name = "m_lib.defenc",
+    version = "1.0.0",
+    description = "Broytman Library for Python",
+    long_description = "Broytman Library for Python, Copyright (C) 1996-2017 PhiloSoft Design",
+    author = "Oleg Broytman",
+    author_email = "phd@phdru.name",
+    url = "http://phdru.name/Software/Python/#m_lib",
+    license = "GPL",
+    keywords=[''],
+    classifiers=[
+        'Development Status :: 5 - Production/Stable',
+        'Intended Audience :: Developers',
+        'License :: OSI Approved :: GNU General Public License (GPL)',
+        'Operating System :: OS Independent',
+        'Programming Language :: Python :: 2',
+        'Programming Language :: Python :: 2.6',
+        'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: 3',
+        'Programming Language :: Python :: 3.4',
+        'Topic :: Software Development :: Libraries',
+        'Topic :: Software Development :: Libraries :: Python Modules',
+    ],
+    platforms = "All",
+    packages = ["m_lib"],
+    namespace_packages = ["m_lib"],
+)
diff --git a/update b/update
new file mode 100755 (executable)
index 0000000..690ecaa
--- /dev/null
+++ b/update
@@ -0,0 +1,2 @@
+#! /bin/sh
+exec "$HOME"/admin/prog/git-scripts/update