reorg: Eliminate use of the module directory.
This directory contained a mix of both c/cython source code, scripts, and build information. Now, source is in src, scripts are in scripts, and setup.py is in the root.
This commit is contained in:
@@ -40,13 +40,9 @@ setup () {
|
||||
pushd $1 >/dev/null
|
||||
|
||||
python setup.py $QUIET \
|
||||
build -b build/lib.$variant -t build/tmp.$variant $BUILD_J \
|
||||
build -b tmp/build/lib.$variant -t tmp/build/tmp.$variant $BUILD_J \
|
||||
$RENPY_BUILD_ARGS install $ADAPT_TO_SETUPTOOLS
|
||||
|
||||
if [ -e install_headers.py ]; then
|
||||
python install_headers.py $VIRTUAL_ENV
|
||||
fi
|
||||
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
@@ -55,14 +51,13 @@ if [ -e "$ROOT/pygame_sdl2" ]; then
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ -e "$ROOT/cubism" ]; then
|
||||
export CUBISM="$ROOT/cubism"
|
||||
export CUBISM_PLATFORM=${CUBISM_PLATFORM:-linux/x86_64}
|
||||
export LD_LIBRARY_PATH="$CUBISM/Core/dll/$CUBISM_PLATFORM"
|
||||
fi
|
||||
|
||||
setup "$ROOT/module/"
|
||||
setup "$ROOT/"
|
||||
|
||||
python "$ROOT/distribute.py" --link-directories
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ BASE = os.path.dirname(os.path.abspath(__file__))
|
||||
ROOT = os.path.dirname(BASE)
|
||||
|
||||
import setuplib
|
||||
module_gen = "module/" + setuplib.gen
|
||||
|
||||
|
||||
def sorted_dict(**kwargs):
|
||||
@@ -507,7 +506,7 @@ def generate_constants():
|
||||
This generates code that defines the property functions.
|
||||
"""
|
||||
|
||||
g = CodeGen(module_gen + "/styleconstants.pxi")
|
||||
g = CodeGen(setuplib.gen + "/styleconstants.pxi")
|
||||
|
||||
g.write("DEF PRIORITY_LEVELS = {}", PRIORITY_LEVELS)
|
||||
g.write("DEF PREFIX_COUNT = {}", PREFIX_COUNT)
|
||||
@@ -579,7 +578,7 @@ def generate_property_functions():
|
||||
"""
|
||||
|
||||
for prefix in sorted(prefixes.values(), key=lambda p : p.index):
|
||||
g = CodeGen(module_gen + "/style_{}functions.pyx".format(prefix.name))
|
||||
g = CodeGen(setuplib.gen + "/style_{}functions.pyx".format(prefix.name))
|
||||
|
||||
g.write('include "style_common.pxi"')
|
||||
g.write('')
|
||||
@@ -622,7 +621,7 @@ def generate_property(g, propname):
|
||||
|
||||
def generate_properties():
|
||||
|
||||
g = CodeGen(module_gen + "/styleclass.pxi")
|
||||
g = CodeGen(setuplib.gen + "/styleclass.pxi")
|
||||
|
||||
g.write("cdef class Style(StyleCore):")
|
||||
g.write("")
|
||||
@@ -660,7 +659,7 @@ def generate_sets():
|
||||
prefix_priority[p.name] = p.priority
|
||||
prefix_alts[p.name] = p.alt_names
|
||||
|
||||
g = CodeGen(module_gen + "/stylesets.pxi")
|
||||
g = CodeGen(setuplib.gen + "/stylesets.pxi")
|
||||
|
||||
g.write("# This file is generated by generate_styles.py.")
|
||||
g.write("")
|
||||
@@ -53,13 +53,8 @@ coverage = "RENPY_COVERAGE" in os.environ
|
||||
# Are we doing a static build?
|
||||
static = "RENPY_STATIC" in os.environ
|
||||
|
||||
gen = "gen"
|
||||
|
||||
if sys.version_info.major > 2:
|
||||
gen += "3"
|
||||
PY2 = False
|
||||
else:
|
||||
PY2 = True
|
||||
gen = "tmp/gen3"
|
||||
PY2 = False
|
||||
|
||||
if coverage:
|
||||
gen += "-coverage"
|
||||
@@ -93,7 +88,7 @@ else:
|
||||
install = [ ]
|
||||
|
||||
# The include and library dirs that we compile against.
|
||||
include_dirs = [ "." ]
|
||||
include_dirs = [ "src" ]
|
||||
library_dirs = [ ]
|
||||
|
||||
# Extra arguments that will be given to the compiler.
|
||||
@@ -229,13 +224,14 @@ def cython(name, source=[], libs=[], includes=[], compile_if=True, define_macros
|
||||
else:
|
||||
fn = "/".join(split_name) + ".pyx"
|
||||
|
||||
if os.path.exists(os.path.join("..", fn)):
|
||||
fn = os.path.join("..", fn)
|
||||
elif os.path.exists(fn):
|
||||
pass
|
||||
for d in [ ".", "src" ]:
|
||||
prepended = os.path.join(d, fn)
|
||||
if os.path.exists(prepended):
|
||||
fn = prepended
|
||||
break
|
||||
else:
|
||||
print("Could not find {0}.".format(fn))
|
||||
sys.exit(-1)
|
||||
raise SystemExit("Could not find {0}.".format(fn))
|
||||
|
||||
|
||||
module_dir = os.path.dirname(fn)
|
||||
|
||||
@@ -282,16 +278,11 @@ def cython(name, source=[], libs=[], includes=[], compile_if=True, define_macros
|
||||
|
||||
for dep_fn in deps:
|
||||
|
||||
if os.path.exists(os.path.join(module_dir, dep_fn)):
|
||||
dep_fn = os.path.join(module_dir, dep_fn)
|
||||
elif os.path.exists(os.path.join("..", dep_fn)):
|
||||
dep_fn = os.path.join("..", dep_fn)
|
||||
elif os.path.exists(os.path.join("include", dep_fn)):
|
||||
dep_fn = os.path.join("include", dep_fn)
|
||||
elif os.path.exists(os.path.join(gen, dep_fn)):
|
||||
dep_fn = os.path.join(gen, dep_fn)
|
||||
elif os.path.exists(dep_fn):
|
||||
pass
|
||||
for d in [ module_dir, ".", "src", gen ]:
|
||||
prepended = os.path.join(d, dep_fn)
|
||||
if os.path.exists(prepended):
|
||||
dep_fn = prepended
|
||||
break
|
||||
else:
|
||||
print("{0} depends on {1}, which can't be found.".format(fn, dep_fn))
|
||||
sys.exit(-1)
|
||||
@@ -341,9 +332,9 @@ def generate_cython(name, language, mod_coverage, split_name, fn, c_fn):
|
||||
|
||||
p = subprocess.Popen([
|
||||
cython_command,
|
||||
"-Iinclude",
|
||||
"-Isrc",
|
||||
"-I" + gen,
|
||||
"-I..",
|
||||
"-I.",
|
||||
"--3str",
|
||||
] + annotate + lang_args + coverage_args + [
|
||||
"-X", "profile=False",
|
||||
@@ -480,6 +471,4 @@ def setup(name, version):
|
||||
)
|
||||
|
||||
|
||||
# Ensure the gen directory exists.
|
||||
if not os.path.exists(gen):
|
||||
os.mkdir(gen)
|
||||
os.makedirs(gen, exist_ok=True)
|
||||
+10
-20
@@ -34,15 +34,8 @@ import future
|
||||
BASE = os.path.abspath(os.path.dirname(sys.argv[0]))
|
||||
os.chdir(BASE)
|
||||
|
||||
# Create the gen directory if it doesn't exist.
|
||||
try:
|
||||
os.makedirs("gen")
|
||||
except Exception:
|
||||
pass
|
||||
sys.path.insert(0, os.path.join(BASE, 'scripts'))
|
||||
|
||||
# Generate styles.
|
||||
import generate_styles
|
||||
generate_styles.generate()
|
||||
|
||||
# If RENPY_CC or RENPY_LD are in the environment, and CC or LD are not, use them.
|
||||
def setup_env(name):
|
||||
@@ -58,6 +51,9 @@ setup_env("CXX")
|
||||
import setuplib
|
||||
from setuplib import android, ios, emscripten, raspi, include, library, cython, cmodule, copyfile, find_unnecessary_gen, generate_all_cython, PY2
|
||||
|
||||
import generate_styles
|
||||
generate_styles.generate()
|
||||
|
||||
# These control the level of optimization versus debugging.
|
||||
setuplib.extra_compile_args = [ "-Wno-unused-function" ]
|
||||
setuplib.extra_link_args = [ ]
|
||||
@@ -72,9 +68,6 @@ else:
|
||||
windows = False
|
||||
tfd_libs = [ ]
|
||||
|
||||
if raspi:
|
||||
setuplib.extra_compile_args.append("-DRASPBERRY_PI")
|
||||
|
||||
include("zlib.h")
|
||||
include("png.h")
|
||||
include("SDL.h", directory="SDL2")
|
||||
@@ -115,13 +108,13 @@ if cubism:
|
||||
# Modules directory.
|
||||
cython(
|
||||
"_renpy",
|
||||
[ "IMG_savepng.c", "core.c" ],
|
||||
[ "src/IMG_savepng.c", "src/core.c" ],
|
||||
sdl + [ png, 'z', 'm' ])
|
||||
|
||||
cython("_renpybidi", [ "renpybidicore.c" ], [ "fribidi" ])
|
||||
cython("_renpybidi", [ "src/renpybidicore.c" ], [ "fribidi" ])
|
||||
|
||||
if not (android or ios or emscripten):
|
||||
cython("_renpytfd", [ "tinyfiledialogs/tinyfiledialogs.c" ], libs=tfd_libs)
|
||||
cython("_renpytfd", [ "src/tinyfiledialogs/tinyfiledialogs.c" ], libs=tfd_libs)
|
||||
|
||||
# Sound.
|
||||
|
||||
@@ -140,7 +133,7 @@ if has_swscale:
|
||||
|
||||
cython(
|
||||
"renpy.audio.renpysound",
|
||||
[ "renpysound_core.c", "ffmedia.c" ],
|
||||
[ "src/renpysound_core.c", "src/ffmedia.c" ],
|
||||
libs=sdl + sound,
|
||||
define_macros=macros,
|
||||
compile_args=[ "-Wno-deprecated-declarations" ] if ("RENPY_FFMPEG_NO_DEPRECATED_DECLARATIONS" in os.environ) else [ ])
|
||||
@@ -189,20 +182,17 @@ cython("renpy.text.texwrap")
|
||||
|
||||
cython(
|
||||
"renpy.text.ftfont",
|
||||
[ "ftsupport.c", "ttgsubtable.c" ],
|
||||
[ "src/ftsupport.c", "src/ttgsubtable.c" ],
|
||||
libs=sdl + [ 'freetype', 'z', 'm' ])
|
||||
|
||||
cython(
|
||||
"renpy.text.hbfont",
|
||||
[ "ftsupport.c" ],
|
||||
[ "src/ftsupport.c" ],
|
||||
libs=sdl + [ 'harfbuzz', 'freetype', 'z', 'm' ])
|
||||
|
||||
generate_all_cython()
|
||||
find_unnecessary_gen()
|
||||
|
||||
# Figure out the version, and call setup.
|
||||
sys.path.insert(0, '..')
|
||||
|
||||
import renpy
|
||||
|
||||
setuplib.setup("Ren'Py", renpy.version[7:].rstrip('un')) # @UndefinedVariable
|
||||
Reference in New Issue
Block a user