mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 11:21:16 +00:00
Fix code generation and tests after reorganization
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#!/bin/env python
|
||||
|
||||
import os
|
||||
import json
|
||||
import itertools
|
||||
|
||||
@@ -9,12 +10,12 @@ import django.template.loader
|
||||
|
||||
django.conf.settings.configure(
|
||||
TEMPLATE_DIRS = (
|
||||
"CodeGenerator/templates",
|
||||
os.path.join( os.path.dirname( __file__ ), "templates" ),
|
||||
),
|
||||
TEMPLATE_STRING_IF_INVALID = "We have a logic error in our template or API description",
|
||||
)
|
||||
|
||||
description = json.load( open( "JsonDescriptionOfGithubApiV3/description.001.normalized.json" ) )
|
||||
description = json.load( open( os.path.join( os.path.dirname( __file__ ), "JsonDescriptionOfGithubApiV3", "description.001.normalized.json" ) ) )
|
||||
|
||||
for class_ in description[ "classes" ]:
|
||||
dependencies = set()
|
||||
@@ -32,7 +33,7 @@ for class_ in description[ "classes" ]:
|
||||
|
||||
githubObjectTemplate = django.template.loader.get_template( "GithubObject.py" )
|
||||
for class_ in description[ "classes" ]:
|
||||
with open( "github/GithubObjects/" + class_[ "name" ] + ".py", "w" ) as f:
|
||||
with open( os.path.join( os.path.dirname( __file__ ), "..", "src", "github", class_[ "name" ] + ".py" ), "w" ) as f:
|
||||
f.write( "# WARNING: this file is generated automaticaly.\n" )
|
||||
f.write( "# Do not modify it manually, your work would be lost.\n" )
|
||||
f.write( "\n" )
|
||||
@@ -50,7 +51,7 @@ for class_ in description[ "classes" ]:
|
||||
f.write( "\n".join( code ) + "\n" )
|
||||
|
||||
referenceOfClassesTemplate = django.template.loader.get_template( "ReferenceOfClasses.md" )
|
||||
with open( "ReferenceOfClasses.md", "w" ) as f:
|
||||
with open( os.path.join( os.path.dirname( __file__ ), "..", "doc", "ReferenceOfClasses.md" ), "w" ) as f:
|
||||
rawCode = referenceOfClassesTemplate.render( django.template.Context( description ) ).split( "\n" )
|
||||
code = list()
|
||||
for line in rawCode:
|
||||
|
||||
Reference in New Issue
Block a user