Skip to content

Commit

Permalink
add yapf style and apply yapf to format all Python files
Browse files Browse the repository at this point in the history
This recreates pull request bulletphysics#2192
  • Loading branch information
Erwin Coumans committed Apr 27, 2019
1 parent c591735 commit ef9570c
Show file tree
Hide file tree
Showing 347 changed files with 71,259 additions and 23,707 deletions.
5 changes: 5 additions & 0 deletions .style.yapf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[style]
based_on_style = google
column_limit = 99
indent_width = 2

74 changes: 35 additions & 39 deletions Extras/Serialize/HeaderGenerator/blenderGenerate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import dump


header = """/* Copyright (C) 2006 Charlie C
*
* This software is provided 'as-is', without any express or implied
Expand All @@ -27,27 +26,30 @@
out = "../BlenderSerialize/autogenerated/"
spaces = 4


def addSpaces(file, space):
for i in range(0, space):
file.write(" ")
for i in range(0, space):
file.write(" ")


def write(file, spaces, string):
addSpaces(file, spaces)
file.write(string)
addSpaces(file, spaces)
file.write(string)


###################################################################################
blender = open(out+"blender.h", 'w')
blender = open(out + "blender.h", 'w')
blender.write(header)
blender.write("#ifndef __BLENDER_H__\n")
blender.write("#define __BLENDER_H__\n")
for dt in dtList:
blender.write("#include \"%s.h\"\n"%dt.filename)
blender.write("#include \"%s.h\"\n" % dt.filename)

blender.write("#endif//__BLENDER_H__")
blender.close()

###################################################################################
blenderC = open(out+"blender_Common.h", 'w')
blenderC = open(out + "blender_Common.h", 'w')
blenderC.write(header)
blenderC.write("#ifndef __BLENDERCOMMON_H__\n")
blenderC.write("#define __BLENDERCOMMON_H__\n")
Expand All @@ -63,49 +65,43 @@ def write(file, spaces, string):

blenderC.write("namespace Blender {\n")
for dt in dtList:
write(blenderC, 4, "class %s;\n"%dt.name)
write(blenderC, 4, "class %s;\n" % dt.name)

blenderC.write("}\n")
blenderC.write("#endif//__BLENDERCOMMON_H__")
blenderC.close()


for dt in dtList:
fp = open(out+dt.filename+".h", 'w')

fp.write(header)
strUpper = dt.filename.upper()

fp.write("#ifndef __%s__H__\n"%strUpper)
fp.write("#define __%s__H__\n"%strUpper)
fp.write("\n\n")


fp.write("// -------------------------------------------------- //\n")
fp.write("#include \"blender_Common.h\"\n")
fp = open(out + dt.filename + ".h", 'w')

for i in dt.includes:
fp.write("#include \"%s\"\n"%i)
fp.write(header)
strUpper = dt.filename.upper()

fp.write("\nnamespace Blender {\n")
fp.write("\n\n")
fp.write("#ifndef __%s__H__\n" % strUpper)
fp.write("#define __%s__H__\n" % strUpper)
fp.write("\n\n")

addSpaces(fp,4)
fp.write("// ---------------------------------------------- //\n")
fp.write("// -------------------------------------------------- //\n")
fp.write("#include \"blender_Common.h\"\n")

for i in dt.includes:
fp.write("#include \"%s\"\n" % i)

write(fp, 4, "class %s\n"%dt.name)
fp.write("\nnamespace Blender {\n")
fp.write("\n\n")

write(fp, 4, "{\n")
write(fp, 4, "public:\n")
for i in dt.dataTypes:
write(fp, 8, i+";\n")
addSpaces(fp, 4)
fp.write("// ---------------------------------------------- //\n")

write(fp, 4, "class %s\n" % dt.name)

write(fp, 4, "};\n")
fp.write("}\n")
fp.write("\n\n")
fp.write("#endif//__%s__H__\n"%strUpper)
fp.close()
write(fp, 4, "{\n")
write(fp, 4, "public:\n")
for i in dt.dataTypes:
write(fp, 8, i + ";\n")


write(fp, 4, "};\n")
fp.write("}\n")
fp.write("\n\n")
fp.write("#endif//__%s__H__\n" % strUpper)
fp.close()
51 changes: 25 additions & 26 deletions Extras/Serialize/HeaderGenerator/bulletGenerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
sys.path.append(".")
import dump



header = """/* Copyright (C) 2011 Erwin Coumans & Charlie C
*
* This software is provided 'as-is', without any express or implied
Expand All @@ -30,23 +28,25 @@
out = "autogenerated/"
spaces = 4


def addSpaces(file, space):
for i in range(0, space):
file.write(" ")
for i in range(0, space):
file.write(" ")


def write(file, spaces, string):
addSpaces(file, spaces)
file.write(string)
addSpaces(file, spaces)
file.write(string)


###################################################################################
blender = open(out+"bullet.h", 'w')
blender = open(out + "bullet.h", 'w')
blender.write(header)
blender.write("#ifndef __BULLET_H__\n")
blender.write("#define __BULLET_H__\n")
#for dt in dtList:
# blender.write("struct %s;\n"%dt.filename)


###################################################################################

blender.write("namespace Bullet {\n")
Expand All @@ -61,26 +61,25 @@ def write(file, spaces, string):
blender.write(strUnRes)

for dt in dtList:
write(blender, 4, "class %s;\n"%dt.name)

write(blender, 4, "class %s;\n" % dt.name)

for dt in dtList:
strUpper = dt.filename.upper()
blender.write("// -------------------------------------------------- //\n")

write(blender, 4, "class %s\n"%dt.name)

write(blender, 4, "{\n")
write(blender, 4, "public:\n")
for i in dt.dataTypes:
write(blender, 8, i+";\n")

write(blender, 4, "};\n")
blender.write("\n\n")

strUpper = dt.filename.upper()

blender.write("// -------------------------------------------------- //\n")

write(blender, 4, "class %s\n" % dt.name)

write(blender, 4, "{\n")
write(blender, 4, "public:\n")
for i in dt.dataTypes:
write(blender, 8, i + ";\n")

write(blender, 4, "};\n")

blender.write("\n\n")

blender.write("}\n")
blender.write("#endif//__BULLET_H__")
blender.close()
12 changes: 6 additions & 6 deletions build3/cmake/FindLibPython.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
print("major_version:%s" % str(sys.version_info[0]))
print("minor_version:%s" % str(sys.version_info[1]))
print("patch_version:%s" % str(sys.version_info[2]))
print("short_version:%s" % '.'.join(map(lambda x:str(x), sys.version_info[0:2])))
print("long_version:%s" % '.'.join(map(lambda x:str(x), sys.version_info[0:3])))
print("short_version:%s" % '.'.join(map(lambda x: str(x), sys.version_info[0:2])))
print("long_version:%s" % '.'.join(map(lambda x: str(x), sys.version_info[0:3])))
print("py_inc_dir:%s" % distutils.sysconfig.get_python_inc())
print("site_packages_dir:%s" % distutils.sysconfig.get_python_lib(plat_specific=1))
for e in distutils.sysconfig.get_config_vars ('LIBDIR'):
if e != None:
print("py_lib_dir:%s" % e)
break
for e in distutils.sysconfig.get_config_vars('LIBDIR'):
if e != None:
print("py_lib_dir:%s" % e)
break
Loading

0 comments on commit ef9570c

Please sign in to comment.