-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
76 lines (61 loc) · 2.36 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python
import os
from setuptools import setup
from setuptools.command.build_py import build_py
packages = []
base_path = os.path.abspath(os.path.dirname(__file__))
class my_build_py(build_py):
def get_data_files(self):
return build_py.get_data_files(self)
def find_data_files(self, package, src_dir):
files = []
for dirpath, dirnames, filenames in os.walk(
os.path.join(src_dir), topdown=True):
for i, dirname in enumerate(dirnames):
if os.path.exists(os.path.join(src_dir, dirname,
'__init__.py')):
del dirnames[i]
if '__init__.py' not in filenames:
files.extend([os.path.join(dirpath, x) for x in filenames
if not x.startswith('.')])
return files
def fullsplit(path, result=None, base_path=None):
"""
Split a pathname into components (the opposite of os.path.join) in a
platform-neutral way.
"""
if base_path:
path = path.replace(base_path, '')
if result is None:
result = []
head, tail = os.path.split(path)
if head == '':
return [tail] + result
if head == path:
return result
return fullsplit(head, [tail] + result)
for dirpath, dirnames, filenames in os.walk(
os.path.join(base_path, 'scarlet'),
followlinks=False):
# Ignore dirnames that start with '.'
for i, dirname in enumerate(dirnames):
if dirname.startswith('.'): del dirnames[i]
if '__init__.py' in filenames:
packages.append('.'.join(fullsplit(dirpath, base_path=base_path)))
setup(
name='scarlet',
version=__import__('scarlet').__version__,
description='A replacement for the Django Admin, focused on Content Management',
author='RED Interactive Agency',
author_email='geeks@ff0000.com',
url='http://github.com/ff0000/scarlet/',
license='MIT',
install_requires=['django-taggit==0.22.0', 'django>=1.11,<1.12'],
packages=packages,
cmdclass={'build_py': my_build_py},
classifiers=[
'Development Status :: 4 - Beta', 'Environment :: Web Environment',
'Framework :: Django', 'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License', 'Operating System :: POSIX',
'Programming Language :: Python'
])