Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 93 lines (80 sloc) 3.193 kb
826898c @areski import project
areski authored
1 from setuptools import setup
2 import os
3 import sys
4 import re
5
6 version='0.1.0'
7
8 packages, data_files = [], []
9 root_dir = os.path.dirname(__file__)
10 if root_dir:
11 os.chdir(root_dir)
12
13 for dirpath, dirnames, filenames in os.walk('country_dialcode'):
14 # Ignore dirnames that start with '.'
15 for i, dirname in enumerate(dirnames):
16 if dirname.startswith('.'): del dirnames[i]
17 if '__init__.py' in filenames:
18 pkg = dirpath.replace(os.path.sep, '.')
19 if os.path.altsep:
20 pkg = pkg.replace(os.path.altsep, '.')
21 packages.append(pkg)
22 elif filenames:
23 prefix = dirpath[12:]
24 for f in filenames:
25 data_files.append(os.path.join(prefix, f))
26
27 def parse_requirements(file_name):
28 requirements = []
29 for line in open(file_name, 'r').read().split('\n'):
30 if re.match(r'(\s*#)|(\s*$)', line):
31 continue
32 if re.match(r'\s*-e\s+', line):
33 requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', line))
34 elif re.match(r'(\s*git)|(\s*hg)', line):
35 pass
36 else:
37 requirements.append(line)
38 return requirements
39
40
41 def parse_dependency_links(file_name, install_flag=False):
42 dependency_links = []
43 for line in open(file_name, 'r').read().split('\n'):
44 if re.match(r'\s*-e\s+', line):
45 dependency_links.append(re.sub(r'\s*-e\s+', '', line))
46 if re.match(r'(\s*git)|(\s*hg)', line):
47 if install_flag == True:
48 line_arr = line.split('/')
49 line_arr_length = len(line.split('/'))
50 pck_name = line_arr[line_arr_length - 1].split('.git')
51 if len(pck_name) == 2:
52 os.system('pip install -f %s %s' % (pck_name[0], line))
53 if len(pck_name) == 1:
54 os.system('pip install -f %s %s' % (pck_name, line))
55 return dependency_links
56
57
58 install_flag=False
59 if sys.argv[1] == "install":
60 install_flag = True
61
62
63
64 setup(
65 name='django-country-dialcode',
66 version=version,
67 description='Application providing Dialcode and Countries code',
68 author='Belaid Arezqui',
69 author_email='areski@gmail.com',
70 url='http://github.com/Star2Billing/django-country-dialcode',
71 packages=['country_dialcode'],
72 package_dir={'country_dialcode': 'country_dialcode'},
73 package_data={'country_dialcode': data_files},
74 download_url='https://github.com/Star2Billing/django-country-dialcode/tarball/master',
75 zip_safe = False,
76 entry_points={'django.apps': 'country_dialcode = country_dialcode'},
77 install_requires = parse_requirements('requirements.txt'),
78 dependency_links = parse_dependency_links('requirements.txt',
79 install_flag),
80 license='MIT License',
81 classifiers=[
82 'Development Status :: 4 - Beta',
83 'Environment :: Web Environment',
84 'Framework :: Django',
85 'Intended Audience :: Developers',
86 'License :: OSI Approved :: MIT License',
87 'Operating System :: OS Independent',
88 'Programming Language :: Python',
89 'Topic :: Software Development :: Libraries :: Python Modules'
90 ],
91 )
92
Something went wrong with that request. Please try again.