Metadata-Version: 2.1
Name: cmagic
Version: 0.3.1
Summary: Python wrapper for libmagic
Home-page: UNKNOWN
Author: Dmitry Orlov <me@mosquito.su>
Author-email: me@mosquito.su
License: Apache Software License
Project-URL: Documentation, https://github.com/mosquito/cmagic/
Project-URL: Source, https://github.com/mosquito/cmagic
Platform: UNKNOWN
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.5.*, <4
Provides-Extra: develop
Requires-Dist: pytest ; extra == 'develop'
Requires-Dist: pytest-cov ; extra == 'develop'

cmagic
======

.. image:: https://github.com/mosquito/cmagic/workflows/tox/badge.svg
    :target: https://github.com/mosquito/cmagic/actions?query=workflow%3Atox
    :alt: Github Actions

.. image:: https://img.shields.io/pypi/v/cmagic.svg
    :target: https://pypi.python.org/pypi/cmagic/
    :alt: Latest Version

.. image:: https://img.shields.io/pypi/wheel/cmagic.svg
    :target: https://pypi.python.org/pypi/cmagic/

.. image:: https://img.shields.io/pypi/pyversions/cmagic.svg
    :target: https://pypi.python.org/pypi/cmagic/

.. image:: https://img.shields.io/pypi/l/cmagic.svg
    :target: https://pypi.python.org/pypi/cmagic/

Python wrapper for libmagic.

Usage
-----

.. code-block::

   # MacOS
   $ export MAGIC=/usr/local/Cellar/libmagic/5.39/share/misc/magic.mgc

   # Ubuntu
   $ export MAGIC=/usr/lib/file/magic.mgc

.. code-block:: python

   import cmagic

   m = cmagic.Magic()

   if m.check(cmagic.MAGIC_DB):
      print("Database is ok")

   m.load()

   m.guess_file("/bin/sh")
   # 'ASCII text'



Installation
------------

Ubuntu/Debian
+++++++++++++

.. code-block:: bash

   apt-get install -y libmagic1 libmagic-mgc   # when using manilinux wheel
   apt-get install -y libmagic-dev             # for building from sources
   python3 -m pip install cmagic


Centos
++++++

.. code-block:: bash

   yum install -y file-libs            # when using manilinux wheel
   yum install -y file-devel           # for building from sources
   python3 -m pip install cmagic


MacOS
+++++

.. code-block:: bash

   brew install libmagic
   python3 -m pip install cmagic


