From 597d8b79d75dbba14904e9bf3d4218af01883647 Mon Sep 17 00:00:00 2001 From: James Brown Date: Wed, 1 Sep 2021 12:20:24 -0700 Subject: [PATCH] add pypi packaging --- setup.py | 47 +++++++++++++++++++++++++++++++++++ statx.py => statx/__init__.py | 4 ++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 setup.py rename statx.py => statx/__init__.py (98%) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..b1ddf82 --- /dev/null +++ b/setup.py @@ -0,0 +1,47 @@ +import io +import sys + +try: + from setuptools import setup +except ImportError: + from distutils.core import setup + + +if sys.version_info < (3, 0): + long_description_open = io.open +else: + long_description_open = open + +with long_description_open('README.md', encoding='utf-8') as f: + long_description = f.read() + + +setup( + name='pystatx', + version='0.1', + description='statx(2) wrapper', + url='https://github.com/ckarageorgkaneen/pystatx', + packages=['statx'], + long_description=long_description, + long_description_content_type='text/markdown', + project_urls={ + 'Tracker': 'https://github.com/ckarageorgkaneen/pystatx/issues', + 'Source': 'https://github.com/ckarageorgkaneen/pystatx', + }, + license='GPLv3', + python_requires='>=2.7', + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Intended Audience :: Developers", + "Operating System :: POSIX :: Linux", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Topic :: Software Development :: Libraries", + ] +) diff --git a/statx.py b/statx/__init__.py similarity index 98% rename from statx.py rename to statx/__init__.py index cbdefb0..cb4efd9 100644 --- a/statx.py +++ b/statx/__init__.py @@ -10,6 +10,8 @@ def _get_syscall_number(): + if platform.system() != 'Linux': + return None machine = platform.machine() if machine == 'x86_64': return 332 @@ -26,7 +28,7 @@ def _get_syscall_func(): syscall_nr = _get_syscall_number() if syscall_nr is None: raise RuntimeError( - 'Only x86, arm64, x86_64 and ppc64le machines are supported.') + 'Only x86, arm64, x86_64 and ppc64le machines on Linux are supported.') syscall = ctypes.CDLL(None).syscall syscall.restype = ctypes.c_int syscall.argtypes = [