@@ 39-82 (lines=44) @@ | ||
36 | return True |
|
37 | ||
38 | ||
39 | class compile_messages(Command): |
|
40 | description = ("re-compile local message files ('.po' to '.mo'). " |
|
41 | "it require django-admin.py") |
|
42 | user_options = [] |
|
43 | ||
44 | def initialize_options(self): |
|
45 | self.cwd = None |
|
46 | ||
47 | def finalize_options(self): |
|
48 | self.cwd = os.getcwd() |
|
49 | ||
50 | def run(self): |
|
51 | compile_messages.compile_messages() |
|
52 | ||
53 | @classmethod |
|
54 | def compile_messages(cls): |
|
55 | """ |
|
56 | Compile '.po' into '.mo' via 'django-admin.py' thus the function |
|
57 | require the django to be installed. |
|
58 | ||
59 | It return True when the process successfully end, otherwise it print |
|
60 | error messages and return False. |
|
61 | ||
62 | https://docs.djangoproject.com/en/dev/ref/django-admin/#compilemessages |
|
63 | """ |
|
64 | try: |
|
65 | import django |
|
66 | except ImportError: |
|
67 | print('####################################################\n' |
|
68 | 'Django is not installed.\nIt will not be possible to ' |
|
69 | 'compile the locale files during installation of ' |
|
70 | 'django-inspectional-registration.\nPlease, install ' |
|
71 | 'Django first. Done so, install the django-registration' |
|
72 | '-inspectional\n' |
|
73 | '####################################################\n') |
|
74 | return False |
|
75 | else: |
|
76 | original_cwd = os.getcwd() |
|
77 | BASE = os.path.abspath(os.path.dirname(__file__)) |
|
78 | root = os.path.join(BASE, 'src/registration') |
|
79 | os.chdir(root) |
|
80 | os.system('django-admin.py compilemessages') |
|
81 | os.chdir(original_cwd) |
|
82 | return True |
|
83 | ||
84 | ||
85 | class sdist(original_sdist): |
|
@@ 11-36 (lines=26) @@ | ||
8 | VERSION = '0.6.1' |
|
9 | ||
10 | ||
11 | class compile_docs(Command): |
|
12 | description = ("re-compile documentations") |
|
13 | user_options = [] |
|
14 | ||
15 | def initialize_options(self): |
|
16 | self.cwd = None |
|
17 | ||
18 | def finalize_options(self): |
|
19 | self.cwd = os.getcwd() |
|
20 | ||
21 | def run(self): |
|
22 | compile_docs.compile_docs() |
|
23 | ||
24 | @classmethod |
|
25 | def compile_docs(cls): |
|
26 | """ |
|
27 | Compile '.rst' files into '.html' files via Sphinx. |
|
28 | """ |
|
29 | original_cwd = os.getcwd() |
|
30 | BASE = os.path.abspath(os.path.dirname(__file__)) |
|
31 | root = os.path.join(BASE, 'docs') |
|
32 | os.chdir(root) |
|
33 | os.system('make html') |
|
34 | os.system('xdg-open _build/html/index.html') |
|
35 | os.chdir(original_cwd) |
|
36 | return True |
|
37 | ||
38 | ||
39 | class compile_messages(Command): |