/ setup.py
setup.py
 1  #!/usr/bin/env python
 2  # -*- coding: utf-8 -*-
 3  
 4  import os
 5  import re
 6  from os.path import dirname, join
 7  
 8  from setuptools import setup
 9  
10  
11  def get_version(package):
12      init_py = open(os.path.join(package, "__init__.py"), encoding="utf-8").read()
13      return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
14  
15  
16  def get_packages(package):
17      return [
18          dirpath
19          for dirpath, dirnames, filenames in os.walk(package)
20          if os.path.exists(os.path.join(dirpath, "__init__.py"))
21      ]
22  
23  
24  def get_package_data(package):
25      walk = [
26          (dirpath.replace(package + os.sep, "", 1), filenames)
27          for dirpath, dirnames, filenames in os.walk(package)
28          if not os.path.exists(os.path.join(dirpath, "__init__.py"))
29      ]
30  
31      filepaths = []
32      for base, filenames in walk:
33          filepaths.extend([os.path.join(base, filename) for filename in filenames])
34      return {package: filepaths}
35  
36  
37  setup(
38      name="django-admin-permissions",
39      version=get_version("admin_permissions"),
40      url="https://github.com/silentsokolov/django-admin-permissions",
41      license="MIT",
42      description="Very simple extension that adds a permissions check on the field in admin",
43      long_description_content_type="text/x-rst",
44      long_description=open(join(dirname(__file__), "README.rst"), encoding="utf-8").read(),
45      author="Dmitriy Sokolov",
46      author_email="silentsokolov@gmail.com",
47      packages=get_packages("admin_permissions"),
48      package_data=get_package_data("admin_permissions"),
49      include_package_data=True,
50      install_requires=[],
51      python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
52      zip_safe=False,
53      platforms="any",
54      classifiers=[
55          "Development Status :: 5 - Production/Stable",
56          "Environment :: Web Environment",
57          "Framework :: Django",
58          "Intended Audience :: Developers",
59          "License :: OSI Approved :: MIT License",
60          "Operating System :: OS Independent",
61          "Programming Language :: Python",
62          "Programming Language :: Python :: 2",
63          "Programming Language :: Python :: 2.7",
64          "Programming Language :: Python :: 3",
65          "Programming Language :: Python :: 3.5",
66          "Programming Language :: Python :: 3.6",
67          "Programming Language :: Python :: 3.7",
68          "Programming Language :: Python :: 3.8",
69          "Programming Language :: Python :: 3.9",
70          "Programming Language :: Python :: 3.10",
71          "Topic :: Utilities",
72      ],
73  )