-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
91 lines (71 loc) · 2.13 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env python
# System modules
import sys
import os
import shutil
import platform
from os.path import join
# Library modules
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
from distutils.dir_util import copy_tree
# Package modules
if sys.version_info[:2] < (2, 7):
print("Sorry, pyglass requires python version 2.7 or later")
sys.exit(1)
if platform.system() != 'Darwin':
print("Sorry, pyglass only runs on OS X")
sys.exit(1)
class Dir:
BUILD = 'build'
DIST = 'dist'
COCOA = 'cocoa'
COCOA_BUILD = join(COCOA, 'build')
LIB = join('pyglass', 'lib') # Destination directory for vendor/custom libs
VENDOR = 'vendor' # Third-party libraries
def rm_tempdirs():
''' Remove temporary build folders '''
tempdirs = [Dir.BUILD, Dir.COCOA_BUILD, Dir.LIB]
for tempdir in tempdirs:
if os.path.exists(tempdir):
shutil.rmtree(tempdir, ignore_errors=True)
def copy_vendor_libs():
''' Copies third party vendor libs into the module '''
copy_tree('%s/' % Dir.VENDOR, '%s/' % Dir.LIB)
def lib_list():
''' Returns the contents of 'pyglass/lib' as a list of 'lib/*' items for package_data '''
lib_list = []
for (root, dirs, files) in os.walk(Dir.LIB):
for filename in files:
root = root.replace('pyglass/', '')
lib_list.append(join(root, filename))
return lib_list
# Compile custom project
rm_tempdirs()
# Copy over libs into Dir.LIB
os.makedirs(Dir.LIB)
copy_vendor_libs()
package_libs = lib_list()
version = '0.1.2'
setup(
name='pyglass',
version=version,
url='http://github.com/Pixelapse/pyglass',
download_url='https://github.com/Pixelapse/pyglass/tarball/v%s' % version,
description='Mac OS X File Preview Generator',
long_description=open('README.md').read(),
author='Shravan Reddy',
author_email='[email protected]',
maintainer='Pixelapse',
maintainer_email='[email protected]',
packages=find_packages(),
package_data={'': package_libs},
python_requires='>=3',
install_requires=['pxprocess', 'pyunicode', 'PyPDF2'],
include_package_data=True,
zip_safe=False,
license=open('LICENSE').read()
)
rm_tempdirs()