Skip to content

Commit

Permalink
Merge branch 'develop' into FixMinFieldsAndIdfEd
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGlazer committed Jan 8, 2020
2 parents 3cb2d7b + 57ce8de commit 5639b15
Show file tree
Hide file tree
Showing 830 changed files with 8,560 additions and 10,616 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ set( PREV_RELEASE_SHA "921312f" )

set( ENERGYPLUS_VERSION "${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}.${CMAKE_VERSION_PATCH}" )

string( TIMESTAMP CMAKE_YEAR "%Y")

set( CMAKE_VERSION_BUILD "Unknown" CACHE STRING "Build number" )
find_package(Git)

Expand Down Expand Up @@ -72,8 +74,8 @@ option( ENABLE_INSTALL_REMOTE "Enable install_remote and install_remote_plist co

mark_as_advanced( ENABLE_INSTALL_REMOTE )

# we are making python a required dependency, so find it here...starting off by requiring at least 2.7
find_package(PythonInterp 2.7 REQUIRED)
# we are making python a required dependency, so find it here
find_package(PythonInterp 3 REQUIRED)

if( BUILD_TESTING )
option( ENABLE_REGRESSION_TESTING "Enable Regression Tests" OFF )
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
EnergyPlus, Copyright (c) 1996-2019, The Board of Trustees of the University of Illinois, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.
EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.

NOTICE: This Software was developed under funding from the U.S. Department of Energy and the U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform publicly and display publicly, and to permit others to do so.

Expand Down
6 changes: 2 additions & 4 deletions scripts/dev/license-check.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import os
import glob
import licensetext

TOOL_NAME = 'license-check'
Expand Down Expand Up @@ -30,4 +28,4 @@

# Check files
for base in dirs:
checker.check(base)
checker.visit(base)
8 changes: 1 addition & 7 deletions scripts/dev/license-update.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
# Finally, change the "dryrun" parameter back to "True".
#

import os
import glob
import json
import licensetext

TOOL_NAME = 'license-update'
Expand Down Expand Up @@ -72,9 +69,6 @@

# Check files
for base in dirs:
#subdirs = glob.glob(base + '*/')
replacer.check(base)
#for sub in subdirs:
# replacer.check(sub)
replacer.visit(base)

print(replacer.summary())
199 changes: 103 additions & 96 deletions scripts/dev/licensetext.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import codecs
import datetime
import fnmatch
import json
import glob
import os
#
# The previous year that is in the license. It should be a string
#
_previous_year = '2018'
_previous_year = '2019'
#
# From file "EnergyPlus License DRAFT 112015 100 fixed.txt"
#
Expand Down Expand Up @@ -131,6 +129,7 @@ def error(dictionary):

def checkLicense(filename,possible,correct,offset=0,toolname='unspecified',
message=error):
'''Check for a few of the usual issues with the license'''
if possible == correct:
return
try:
Expand Down Expand Up @@ -171,6 +170,7 @@ def checkLicense(filename,possible,correct,offset=0,toolname='unspecified',
'messagetype':'error',
'message':'Non-year differences in license text, check entire license'})


def mergeParagraphs(text):
'''Merge license text lines into a single line per paragraph.'''
lines = []
Expand All @@ -185,125 +185,132 @@ def mergeParagraphs(text):
lines.append(current.lstrip())
return '\n'.join(lines)+'\n'

class Visitor:
def __init__(self):
self.count = 0
def filecheck(self, filepath):
pass
def files(self, path):
return glob.glob(path+'*')
def check(self, path):
for file in self.files(path):
self.filecheck(file)
self.count += 1

class CodeChecker(Visitor):
def __init__(self):
Visitor.__init__(self)
class FileVisitor:
def __init__(self, extensions = None):
self.visited_files = []
if extensions == None:
self.extensions = ['cc', 'cpp', 'c', 'hh', 'hpp', 'h']
else:
self.extensions = extensions

def files(self, path):
extensions = ['cc', 'cpp', 'c', 'hh', 'hpp', 'h']
results = []
for ext in extensions:
results.extend(glob.glob(path+'*.'+ext))
for root, _, filenames in os.walk(path):
for filename in fnmatch.filter(filenames, '*.'+ext):
results.append(os.path.join(root, filename))
for ext in self.extensions:
results.extend(glob.glob(path+'**/*.'+ext, recursive=True))
return results

class Checker(CodeChecker):
def __init__(self, boilerplate, toolname='unspecified', message=error):
CodeChecker.__init__(self)
lines = boilerplate.splitlines()
self.n = len(lines)
self.text = boilerplate
self.toolname = toolname
self.message = message
def filecheck(self, filepath):
fp = codecs.open(filepath,'r',encoding='utf-8',errors='ignore')
def visit_file(self, filepath):
pass

def error(self, file, line_number, mesg):
pass

def visit(self, path):
for file in self.files(path):
self.visit_file(file)
self.visited_files.append(file)

def readtext(self, filepath):
fp = open(filepath, 'r', encoding='utf-8')
try:
txt = fp.read()
except UnicodeDecodeError as exc:
try:
fp.close()
fp = codecs.open(filepath,'r',encoding='utf8')
txt = fp.read()
except:
self.message({'tool':self.toolname,
'filename':filepath,
'file':filepath,
'line':0,
'messagetype':'error',
'message':'UnicodeDecodeError: '+ str(exc)})
fp.close()
return
self.error(filepath, 0, 'UnicodeDecodeError: '+ str(exc))
txt = None
except Exception as exc:
self.error(filepath, 0, 'Exception: '+ str(exc))
txt = None
fp.close()
n = txt.count(self.text)
if n == 0:
lines = txt.splitlines()[:self.n]
shortened = '\n'.join(lines)+'\n'
checkLicense(filepath,shortened,self.text,offset=3,
toolname=self.toolname,message=self.message)
else:
if n > 1:
self.message({'tool':self.toolname,
'filename':filepath,
'file':filepath,
'line':1,
'messagetype':'error',
'message':'Multiple instances of license text'})
if not txt.startswith(self.text):
self.message({'tool':self.toolname,
'filename':filepath,
'file':filepath,
'line':1,
'messagetype':'error',
'message':'License text is not at top of file'})
return txt


class Checker(FileVisitor):
def __init__(self, boilerplate, toolname='unspecified'):
super().__init__()
lines = boilerplate.splitlines()
self.n = len(lines)
self.text = boilerplate
self.toolname = toolname

def error(self, file, line_number, mesg):
dictionary = {'tool':self.toolname,
'filename':file,
'file':file,
'line':line_number,
'messagetype':'error',
'message':mesg}
print(json.dumps(dictionary))

class Replacer(CodeChecker):
def visit_file(self, filepath):
txt = self.readtext(filepath)
if txt != None:
n = txt.count(self.text)
if n == 0:
lines = txt.splitlines()[:self.n]
shortened = '\n'.join(lines)+'\n'
checkLicense(filepath,shortened,self.text,offset=3,
toolname=self.toolname,message=error)
else:
if n > 1:
self.error(filepath, 1, 'Multiple instances of license text')
if not txt.startswith(self.text):
self.error(filepath, 1, 'License text is not at top of file')


class Replacer(FileVisitor):
def __init__(self, oldtext, newtext, dryrun=True):
CodeChecker.__init__(self)
super().__init__()
self.oldtxt = oldtext
self.newtxt = newtext
self.dryrun = dryrun
self.replaced = 0
self.replaced = []
self.failures = []
def filecheck(self,filepath):
fp = codecs.open(filepath,'r',encoding='utf-8',errors='ignore')
try:
txt = fp.read()
except UnicodeDecodeError as exc:
message = filepath + ', UnicodeDecodeError: '+ str(exc)
try:
fp.close()
fp = codecs.open(filepath,'r',encoding='utf8')
txt = fp.read()
except:
self.failures.append(message)
return

def error(self, file, line, mesg):
self.failures.append(file + ', ' + mesg)

def writetext(self, filepath, txt):
fp = open(filepath, 'w', encoding='utf-8')
fp.write(txt)
fp.close()
if self.dryrun:
if self.oldtxt in txt:
self.replaced += 1
else:
txt = txt.replace(self.oldtxt, self.newtxt)
if self.newtxt in txt:
fp = codecs.open(filepath,'w',encoding='utf-8',errors='ignore')
fp.write(txt)
fp.close()
self.replaced += 1

def visit_file(self,filepath):
txt = self.readtext(filepath)
if txt != None:
if self.dryrun:
if self.oldtxt in txt:
self.replaced.append(filepath)
else:
txt = txt.replace(self.oldtxt, self.newtxt)
if self.newtxt in txt:
self.writetext(filepath, txt)
self.replaced.append(filepath)

def summary(self):
txt = ['Checked %d files' % self.count]
txt = ['Checked %d files' % len(self.visited_files)]
if self.dryrun:
txt.append('Would have replaced text in %d files' % self.replaced)
txt.append('Would have replaced text in %d files' % len(self.replaced))
else:
txt.append('Replaced text in %d files' % self.replaced)
txt.append('Replaced text in %d files' % len(self.replaced))
if len(self.failures):
txt.append('Failures in %d files' % len(self.failures))
for message in self.failures:
txt.append('\t' + message)
return '\n'.join(txt)

def report(self):
remaining = self.visited_files[:]
txt = ['Replaced text in the following files']
for file in self.replaced:
remaining.remove(file)
txt.append('\t'+file)
txt.append('No changes made to the following files')
for file in remaining:
txt.append('\t'+file)
return self.summary() + '\n\n' + '\n'.join(txt)


if __name__ == '__main__':
text = current()
print(text)
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/AirLoopHVACDOAS.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// EnergyPlus, Copyright (c) 1996-2019, The Board of Trustees of the University of Illinois,
// EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois,
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/AirLoopHVACDOAS.hh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// EnergyPlus, Copyright (c) 1996-2019, The Board of Trustees of the University of Illinois,
// EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois,
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/AirTerminalUnit.hh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// EnergyPlus, Copyright (c) 1996-2019, The Board of Trustees of the University of Illinois,
// EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois,
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// EnergyPlus, Copyright (c) 1996-2019, The Board of Trustees of the University of Illinois,
// EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois,
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// EnergyPlus, Copyright (c) 1996-2019, The Board of Trustees of the University of Illinois,
// EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois,
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// EnergyPlus, Copyright (c) 1996-2019, The Board of Trustees of the University of Illinois,
// EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois,
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/AirflowNetwork/src/Elements.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// EnergyPlus, Copyright (c) 1996-2019, The Board of Trustees of the University of Illinois,
// EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois,
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/AirflowNetwork/src/Properties.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// EnergyPlus, Copyright (c) 1996-2019, The Board of Trustees of the University of Illinois,
// EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois,
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/AirflowNetwork/src/Solver.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// EnergyPlus, Copyright (c) 1996-2019, The Board of Trustees of the University of Illinois,
// EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois,
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/AirflowNetworkBalanceManager.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// EnergyPlus, Copyright (c) 1996-2019, The Board of Trustees of the University of Illinois,
// EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois,
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/AirflowNetworkBalanceManager.hh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// EnergyPlus, Copyright (c) 1996-2019, The Board of Trustees of the University of Illinois,
// EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois,
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/BaseboardElectric.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// EnergyPlus, Copyright (c) 1996-2019, The Board of Trustees of the University of Illinois,
// EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois,
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/BaseboardElectric.hh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// EnergyPlus, Copyright (c) 1996-2019, The Board of Trustees of the University of Illinois,
// EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois,
// The Regents of the University of California, through Lawrence Berkeley National Laboratory
// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
Expand Down
Loading

7 comments on commit 5639b15

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FixMinFieldsAndIdfEd (JasonGlazer) - x86_64-Linux-Ubuntu-18.04-gcc-7.4: OK (2638 of 2638 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FixMinFieldsAndIdfEd (JasonGlazer) - x86_64-Linux-Ubuntu-18.04-custom_check: OK (11 of 11 tests passed, 0 test warnings)

Build Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FixMinFieldsAndIdfEd (JasonGlazer) - x86_64-Linux-Ubuntu-18.04-cppcheck: OK (0 of 0 tests passed, 0 test warnings)

Build Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FixMinFieldsAndIdfEd (JasonGlazer) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-UnitTestsCoverage-Debug: OK (1256 of 1256 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FixMinFieldsAndIdfEd (JasonGlazer) - x86_64-Linux-Ubuntu-18.04-gcc-7.4-IntegrationCoverage-Debug: OK (674 of 675 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 674
  • Timeout: 1

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FixMinFieldsAndIdfEd (JasonGlazer) - Win64-Windows-10-VisualStudio-16: OK (2598 of 2598 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FixMinFieldsAndIdfEd (JasonGlazer) - x86_64-MacOS-10.13-clang: Tests Failed (811 of 2598 tests passed, 27 test warnings)

Messages:\n

  • 186 tests had: EIO diffs.
  • 159 tests had: Table big diffs.
  • 182 tests had: AUD diffs.
  • 21 tests had: MTD diffs.
  • 21 tests had: RDD diffs.
  • 24 tests had: BND diffs.
  • 1 test had: ESO small diffs.
  • 1 test had: MTR small diffs.
  • 15 tests had: MDD diffs.
  • 2 tests had: ERR diffs.

Failures:\n

API Test Summary

  • Passed: 7
  • Failed: 1

EnergyPlusFixture Test Summary

  • Passed: 29
  • notrun: 805

integration Test Summary

  • Passed: 672
  • Failed: 4

regression Test Summary

  • Passed: 28
  • Failed: 647

Build Badge Test Badge

Please sign in to comment.