Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
OBITools
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
25
Issues
25
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
OBITools
OBITools
Commits
37d24feb
Commit
37d24feb
authored
Apr 16, 2015
by
Eric Coissac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
parent
ee1063ed
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
105 deletions
+94
-105
build_ext.py
distutils.ext/obidistutils/command/build_ext.py
+78
-79
build_sphinx.py
distutils.ext/obidistutils/command/build_sphinx.py
+8
-20
install_sphinx.py
distutils.ext/obidistutils/command/install_sphinx.py
+0
-1
__init__.py
distutils.ext/obidistutils/serenity/__init__.py
+3
-1
checkpackage.py
distutils.ext/obidistutils/serenity/checkpackage.py
+4
-1
virtual.py
distutils.ext/obidistutils/serenity/virtual.py
+1
-3
No files found.
distutils.ext/obidistutils/command/build_ext.py
View file @
37d24feb
...
...
@@ -9,93 +9,92 @@ import sys
from
obidistutils.serenity
import
is_serenity
import
os
from
obidistutils.serenity.checkpackage
import
install_requirements
from
obidistutils.serenity.rerun
import
rerun_with_anothe_python
try
:
from
Cython.Distutils
import
build_ext
as
ori_build_ext
# @UnresolvedImport
from
distutils.errors
import
DistutilsSetupError
class
build_ext
(
ori_build_ext
):
def
modifyDocScripts
(
self
):
print
>>
open
(
"doc/sphinx/build_dir.txt"
,
"w"
),
self
.
build_lib
def
initialize_options
(
self
):
ori_build_ext
.
initialize_options
(
self
)
# @UndefinedVariable
self
.
littlebigman
=
None
self
.
built_files
=
None
except
ImportError
:
if
install_requirements
():
log
.
info
(
"Restarting installation with all dependencies ok"
)
rerun_with_anothe_python
(
os
.
path
.
realpath
(
sys
.
executable
))
from
distutils.errors
import
DistutilsSetupError
class
build_ext
(
ori_build_ext
):
def
modifyDocScripts
(
self
):
print
>>
open
(
"doc/sphinx/build_dir.txt"
,
"w"
),
self
.
build_lib
def
finalize_options
(
self
):
ori_build_ext
.
finalize_options
(
self
)
# @UndefinedVariable
self
.
set_undefined_options
(
'littlebigman'
,
(
'littlebigman'
,
'littlebigman'
))
self
.
set_undefined_options
(
'build_files'
,
(
'files'
,
'built_files'
))
self
.
cython_c_in_temp
=
1
if
self
.
littlebigman
==
'-DLITTLE_END'
:
if
self
.
define
is
None
:
self
.
define
=
[(
'LITTLE_END'
,
None
)]
else
:
self
.
define
.
append
(
'LITTLE_END'
,
None
)
def
substitute_sources
(
self
,
exe_name
,
sources
):
"""
Substitutes source file name starting by an @ by the actual
name of the built file (see --> build_files)
"""
sources
=
list
(
sources
)
for
i
in
xrange
(
len
(
sources
)):
print
exe_name
,
sources
[
i
],
if
sources
[
i
][
0
]
==
'@'
:
try
:
filename
=
self
.
built_files
[
sources
[
i
][
1
:]]
except
KeyError
:
tmpfilename
=
os
.
path
.
join
(
self
.
build_temp
,
sources
[
i
][
1
:])
if
os
.
path
.
isfile
(
tmpfilename
):
filename
=
tmpfilename
else
:
raise
DistutilsSetupError
,
\
(
'The
%
s filename declared in the source '
'files of the program
%
s have not been '
'built by the installation process'
)
%
(
sources
[
i
],
exe_name
)
sources
[
i
]
=
filename
print
"changed to "
,
filename
else
:
print
" ok"
return
sources
def
build_extensions
(
self
):
# First, sanity-check the 'extensions' list
for
ext
in
self
.
extensions
:
ext
.
sources
=
self
.
substitute_sources
(
ext
.
name
,
ext
.
sources
)
self
.
check_extensions_list
(
self
.
extensions
)
for
ext
in
self
.
extensions
:
print
"#####>"
,
ext
.
sources
ext
.
sources
=
self
.
cython_sources
(
ext
.
sources
,
ext
)
self
.
build_extension
(
ext
)
def
initialize_options
(
self
):
ori_build_ext
.
initialize_options
(
self
)
# @UndefinedVariable
self
.
littlebigman
=
None
self
.
built_files
=
None
def
finalize_options
(
self
):
ori_build_ext
.
finalize_options
(
self
)
# @UndefinedVariable
self
.
set_undefined_options
(
'littlebigman'
,
(
'littlebigman'
,
'littlebigman'
))
self
.
set_undefined_options
(
'build_files'
,
(
'files'
,
'built_files'
))
self
.
cython_c_in_temp
=
1
if
self
.
littlebigman
==
'-DLITTLE_END'
:
if
self
.
define
is
None
:
self
.
define
=
[(
'LITTLE_END'
,
None
)]
else
:
self
.
define
.
append
(
'LITTLE_END'
,
None
)
def
substitute_sources
(
self
,
exe_name
,
sources
):
"""
Substitutes source file name starting by an @ by the actual
name of the built file (see --> build_files)
"""
sources
=
list
(
sources
)
for
i
in
xrange
(
len
(
sources
)):
print
exe_name
,
sources
[
i
],
if
sources
[
i
][
0
]
==
'@'
:
try
:
filename
=
self
.
built_files
[
sources
[
i
][
1
:]]
except
KeyError
:
tmpfilename
=
os
.
path
.
join
(
self
.
build_temp
,
sources
[
i
][
1
:])
if
os
.
path
.
isfile
(
tmpfilename
):
filename
=
tmpfilename
else
:
raise
DistutilsSetupError
,
\
(
'The
%
s filename declared in the source '
'files of the program
%
s have not been '
'built by the installation process'
)
%
(
sources
[
i
],
exe_name
)
sources
[
i
]
=
filename
print
"changed to "
,
filename
else
:
print
" ok"
return
sources
def
build_extensions
(
self
):
# First, sanity-check the 'extensions' list
for
ext
in
self
.
extensions
:
ext
.
sources
=
self
.
substitute_sources
(
ext
.
name
,
ext
.
sources
)
def
run
(
self
):
self
.
modifyDocScripts
()
ori_build_ext
.
run
(
self
)
# @UndefinedVariable
self
.
check_extensions_list
(
self
.
extensions
)
for
ext
in
self
.
extensions
:
print
"#####>"
,
ext
.
sources
ext
.
sources
=
self
.
cython_sources
(
ext
.
sources
,
ext
)
self
.
build_extension
(
ext
)
def
run
(
self
):
self
.
modifyDocScripts
()
ori_build_ext
.
run
(
self
)
# @UndefinedVariable
except
ImportError
:
if
is_serenity
():
from
distutils.command.build_ext
import
build_ext
as
ori_build_ext
# @UnusedImport
else
:
log
.
error
(
'Cython must be installed before installing obitools'
)
sys
.
exit
(
1
)
# from obidistutils.serenity.cython import get_a_cython_module
# import imp
...
...
distutils.ext/obidistutils/command/build_sphinx.py
View file @
37d24feb
...
...
@@ -5,9 +5,17 @@ Created on 10 mars 2015
'''
from
distutils
import
log
from
obidistutils.serenity.checkpackage
import
install_requirements
from
obidistutils.serenity.rerun
import
rerun_with_anothe_python
import
os
import
sys
try
:
from
sphinx.setup_command
import
BuildDoc
as
ori_build_sphinx
except
ImportError
:
if
install_requirements
():
log
.
info
(
"Restarting installation with all dependencies ok"
)
rerun_with_anothe_python
(
os
.
path
.
realpath
(
sys
.
executable
))
class
build_sphinx
(
ori_build_sphinx
):
'''
...
...
@@ -26,23 +34,4 @@ try:
self
.
builder
=
'man'
self
.
finalize_options
()
ori_build_sphinx
.
run
(
self
)
except
ImportError
:
from
distutils.core
import
Command
class
build_sphinx
(
Command
):
'''
Build Sphinx documentation in html, epub and man formats
'''
description
=
__doc__
def
initialize_options
(
self
):
pass
def
finalize_options
(
self
):
pass
def
run
(
self
):
log
.
info
(
"Sphinx not installed documentation will not be generated"
)
\ No newline at end of file
distutils.ext/obidistutils/command/install_sphinx.py
View file @
37d24feb
...
...
@@ -4,7 +4,6 @@ Created on 10 mars 2015
@author: coissac
'''
from
distutils.core
import
Command
import
os
import
os.path
import
glob
...
...
distutils.ext/obidistutils/serenity/__init__.py
View file @
37d24feb
...
...
@@ -63,7 +63,9 @@ def serenity_snake(envname,package,version,minversion=PIP_MINVERSION):
log
.
info
(
"
%
s will be installed with python :
%
s"
%
(
package
,
virtualpython
))
install_requirements
()
if
install_requirements
():
log
.
info
(
"Restarting installation with all dependencies ok"
)
rerun_with_anothe_python
(
virtualpython
)
log
.
set_threshold
(
old
)
...
...
distutils.ext/obidistutils/serenity/checkpackage.py
View file @
37d24feb
...
...
@@ -80,7 +80,7 @@ def install_requirements(skip_virtualenv=True,pip=None):
if
pip
is
None
:
pip
=
get_a_pip_module
()
install_something
=
False
try
:
requirements
=
open
(
'requirements.txt'
)
.
readlines
()
requirements
=
[
x
.
strip
()
for
x
in
requirements
]
...
...
@@ -93,9 +93,12 @@ def install_requirements(skip_virtualenv=True,pip=None):
if
not
ok
:
log
.
info
(
" Installing requirement :
%
s"
%
x
)
pip_install_package
(
x
,
pip
=
pip
)
install_something
=
True
except
IOError
:
pass
return
install_something
def
check_requirements
(
skip_virtualenv
=
True
,
pip
=
None
):
...
...
distutils.ext/obidistutils/serenity/virtual.py
View file @
37d24feb
...
...
@@ -113,9 +113,7 @@ def serenity_virtualenv(envname,package,version,minversion=PIP_MINVERSION,pip=No
else
:
ok
=
False
install_requirements
()
#
# Creates a new virtualenv
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment