diff --git a/Calorimeter/CaloBadChannelTool/CMakeLists.txt b/Calorimeter/CaloBadChannelTool/CMakeLists.txt
index bab675063dc5307c0e581dede0460078560fae5d..c39f645f516c8da248454da5c954207ce7c06ebb 100644
--- a/Calorimeter/CaloBadChannelTool/CMakeLists.txt
+++ b/Calorimeter/CaloBadChannelTool/CMakeLists.txt
@@ -23,14 +23,9 @@ atlas_add_component( CaloBadChannelTool
 
 # Install files from the package:
 atlas_install_headers( CaloBadChannelTool )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 
-atlas_install_python_modules( python/*.py )
-
-# Check python syntax:
-atlas_add_test( flake8
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python
-                POST_EXEC_SCRIPT nopost.sh )
-
+# Tests:
 atlas_add_test( CaloBadChanToolConfig_test
                 SCRIPT python -m CaloBadChannelTool.CaloBadChanToolConfig
                 PROPERTIES TIMEOUT 300
diff --git a/Calorimeter/CaloCondBlobAlgs/CMakeLists.txt b/Calorimeter/CaloCondBlobAlgs/CMakeLists.txt
index 2c6f36cb696f6c29daf7e87865a56fabafb41991..50707e0da7fc38e100df5d6a8f44fe383d500797 100644
--- a/Calorimeter/CaloCondBlobAlgs/CMakeLists.txt
+++ b/Calorimeter/CaloCondBlobAlgs/CMakeLists.txt
@@ -30,13 +30,5 @@ atlas_add_component( CaloCondBlobAlgs
 
 # Install files from the package:
 atlas_install_headers( CaloCondBlobAlgs )
-atlas_install_python_modules( python/*.py )
-atlas_install_joboptions( share/*.py )
-
-atlas_add_test( flake8
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python
-                POST_EXEC_SCRIPT nopost.sh )
-
-atlas_add_test( flake8_share
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share
-                POST_EXEC_SCRIPT nopost.sh )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
+atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 )
diff --git a/Calorimeter/CaloCondPhysAlgs/CMakeLists.txt b/Calorimeter/CaloCondPhysAlgs/CMakeLists.txt
index b7bc891cede1f2ef5d8399bf563d6d99d4ab50bc..51d446b0f6ab4702fb282ba71322dfd1085b06d3 100644
--- a/Calorimeter/CaloCondPhysAlgs/CMakeLists.txt
+++ b/Calorimeter/CaloCondPhysAlgs/CMakeLists.txt
@@ -50,14 +50,6 @@ atlas_add_component( CaloCondPhysAlgs
 		     CaloConditions CaloEvent CaloUtilsLib AthenaPoolUtilities Identifier xAODEventInfo LArHV LArReadoutGeometry LArSimEvent CxxUtils)
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
-atlas_install_joboptions( share/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
+atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 )
 atlas_install_scripts( share/CaloRescaleNoiseHV.sh share/CaloNoise_fillDB.py share/CaloPedestalShift.sh share/CaloPedestal_fillDB.py share/CaloScaleNoise_jobOptions.py )
-
-atlas_add_test( flake8
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python
-                POST_EXEC_SCRIPT nopost.sh )
-
-atlas_add_test( flake8_share
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900,ATL901 ${CMAKE_CURRENT_SOURCE_DIR}/share
-                POST_EXEC_SCRIPT nopost.sh )
diff --git a/Calorimeter/CaloCondPhysAlgs/share/EMB-EMEC_PS_Energy_Rescale.py b/Calorimeter/CaloCondPhysAlgs/share/EMB-EMEC_PS_Energy_Rescale.py
index f63d91abf33b9373cc1821c3f7bc029033040439..42534df70dbf3eb939efd9aefcbdd3f520546256 100644
--- a/Calorimeter/CaloCondPhysAlgs/share/EMB-EMEC_PS_Energy_Rescale.py
+++ b/Calorimeter/CaloCondPhysAlgs/share/EMB-EMEC_PS_Energy_Rescale.py
@@ -141,10 +141,10 @@ theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg","dummy.pool.roo
 #Periode C1-C8 (28 Jun - 23 Jul)
 theOutputConditionsAlg.Run1 = RunNumber
 theOutputConditionsAlg.LB1 = 1
-	
+
 #theOutputConditionsAlg.Run2 = LastRunNumber + 1
 #theOutputConditionsAlg.LB2 = 0
-	
+
 svcMgr.IOVDbSvc.dbConnection  = "sqlite://;schema="+sqlite+";dbname=CONDBR2"
 from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
 svcMgr += IOVRegistrationSvc()
diff --git a/Calorimeter/CaloCondPhysAlgs/share/EMBPS_Energy_Rescale.py b/Calorimeter/CaloCondPhysAlgs/share/EMBPS_Energy_Rescale.py
index 306939d251298ff3ef87290bd00e1cabe1e59299..198a88c227de9a5076499f2ee8501351552b8ad5 100644
--- a/Calorimeter/CaloCondPhysAlgs/share/EMBPS_Energy_Rescale.py
+++ b/Calorimeter/CaloCondPhysAlgs/share/EMBPS_Energy_Rescale.py
@@ -141,10 +141,10 @@ theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg","dummy.pool.roo
 #Periode C1-C8 (28 Jun - 23 Jul)
 theOutputConditionsAlg.Run1 = RunNumber
 theOutputConditionsAlg.LB1 = 1
-	
+
 theOutputConditionsAlg.Run2 = LastRunNumber + 1
 theOutputConditionsAlg.LB2 = 0
-	
+
 svcMgr.IOVDbSvc.dbConnection  = "sqlite://;schema="+sqlite+";dbname=COMP200"
 from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
 svcMgr += IOVRegistrationSvc()
diff --git a/Calorimeter/CaloCondPhysAlgs/share/EMBPS_Energy_Rescale_1.py b/Calorimeter/CaloCondPhysAlgs/share/EMBPS_Energy_Rescale_1.py
index 35f835d71a16b639bf9dde9c7a55a9c03ea6eb6a..9200741a73f37eee20edd80b360fd376820ac9a3 100644
--- a/Calorimeter/CaloCondPhysAlgs/share/EMBPS_Energy_Rescale_1.py
+++ b/Calorimeter/CaloCondPhysAlgs/share/EMBPS_Energy_Rescale_1.py
@@ -139,10 +139,10 @@ theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg","dummy.pool.roo
 #Periode C1-C8 (28 Jun - 23 Jul)
 theOutputConditionsAlg.Run1 = RunNumber
 theOutputConditionsAlg.LB1 = 1
-	
+
 #theOutputConditionsAlg.Run2 = LastRunNumber + 1
 #theOutputConditionsAlg.LB2 = 0
-	
+
 svcMgr.IOVDbSvc.dbConnection  = "sqlite://;schema="+sqlite+";dbname=COMP200"
 from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
 svcMgr += IOVRegistrationSvc()
diff --git a/Calorimeter/CaloCondPhysAlgs/share/EMB_EMEC_PS_HV_Energy_Rescale.py b/Calorimeter/CaloCondPhysAlgs/share/EMB_EMEC_PS_HV_Energy_Rescale.py
index 0a091099b03cc90211a2351d927bd5dc00e516c0..28b45c8ae67bb79beef49bf8607face95fcaeb17 100644
--- a/Calorimeter/CaloCondPhysAlgs/share/EMB_EMEC_PS_HV_Energy_Rescale.py
+++ b/Calorimeter/CaloCondPhysAlgs/share/EMB_EMEC_PS_HV_Energy_Rescale.py
@@ -146,10 +146,10 @@ theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg","dummy.pool.roo
 #Periode C1-C8 (28 Jun - 23 Jul)
 theOutputConditionsAlg.Run1 = RunNumber
 theOutputConditionsAlg.LB1 = 1
-	
+
 #theOutputConditionsAlg.Run2 = LastRunNumber + 1
 #theOutputConditionsAlg.LB2 = 0
-	
+
 svcMgr.IOVDbSvc.dbConnection  = "sqlite://;schema="+sqlite+";dbname=CONDBR2"
 from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
 svcMgr += IOVRegistrationSvc()
diff --git a/Calorimeter/CaloCondPhysAlgs/share/EMB_Energy_Rescale.py b/Calorimeter/CaloCondPhysAlgs/share/EMB_Energy_Rescale.py
index 9cc6217392ae0ae373968c36851698d1b02f39d9..1bed3bd5935f5c03f8f035b1166ddaace114cbd5 100644
--- a/Calorimeter/CaloCondPhysAlgs/share/EMB_Energy_Rescale.py
+++ b/Calorimeter/CaloCondPhysAlgs/share/EMB_Energy_Rescale.py
@@ -140,10 +140,10 @@ theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg","dummy.pool.roo
 #Periode C1-C8 (28 Jun - 23 Jul)
 theOutputConditionsAlg.Run1 = RunNumber
 theOutputConditionsAlg.LB1 = 1
-	
+
 theOutputConditionsAlg.Run2 = LastRunNumber + 1
 theOutputConditionsAlg.LB2 = 0
-	
+
 svcMgr.IOVDbSvc.dbConnection  = "sqlite://;schema="+sqlite+";dbname=COMP200"
 from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
 svcMgr += IOVRegistrationSvc()
diff --git a/Calorimeter/CaloCondPhysAlgs/share/FCAL_HV_Energy_Rescale.py b/Calorimeter/CaloCondPhysAlgs/share/FCAL_HV_Energy_Rescale.py
index 5a6f533dec30254c59cc1636982cb136b1cb0576..196a8de0f4011725582ed49787704fb2c725251b 100644
--- a/Calorimeter/CaloCondPhysAlgs/share/FCAL_HV_Energy_Rescale.py
+++ b/Calorimeter/CaloCondPhysAlgs/share/FCAL_HV_Energy_Rescale.py
@@ -136,10 +136,10 @@ theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg","dummy.pool.roo
 #Periode C1-C8 (28 Jun - 23 Jul)
 theOutputConditionsAlg.Run1 = 205248
 theOutputConditionsAlg.LB1 = 1
-	
+
 theOutputConditionsAlg.Run2 = 207332 + 1
 theOutputConditionsAlg.LB2 = 0
-	
+
 svcMgr.IOVDbSvc.dbConnection  = "sqlite://;schema="+sqlite+";dbname=COMP200"
 from RegistrationServices.RegistrationServicesConf import IOVRegistrationSvc
 svcMgr += IOVRegistrationSvc()
diff --git a/Calorimeter/CaloDetDescr/CMakeLists.txt b/Calorimeter/CaloDetDescr/CMakeLists.txt
index 554ef87f6f6ad5824dd265a9d13f0db9af764b11..5f965d517daefd33a24314c06b2cee342b5d5226 100644
--- a/Calorimeter/CaloDetDescr/CMakeLists.txt
+++ b/Calorimeter/CaloDetDescr/CMakeLists.txt
@@ -49,18 +49,9 @@ atlas_add_dictionary( CaloDetDescrDict
                       LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} CaloIdentifier AthenaBaseComps AthenaKernel AthContainers GeoPrimitives Identifier GaudiKernel LArReadoutGeometry CaloConditions CaloGeoHelpers StoreGateLib SGtests CaloDetDescrLib )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
-atlas_install_joboptions( share/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
+atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 )
 
 atlas_add_test( CaloConstIteratorAdaptor_test
   SOURCES test/CaloConstIteratorAdaptor_test.cxx
   LINK_LIBRARIES CaloDetDescrLib )
-
-
-atlas_add_test( flake8
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python
-                POST_EXEC_SCRIPT nopost.sh )
-
-atlas_add_test( flake8_share
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share
-                POST_EXEC_SCRIPT nopost.sh )
diff --git a/Calorimeter/CaloMonitoring/CMakeLists.txt b/Calorimeter/CaloMonitoring/CMakeLists.txt
index 4ab7bc3fe1932a8d0de31b4382210e973b0e12fe..ffd9847da66c26f2b637eea57a24d0e86f9b307b 100644
--- a/Calorimeter/CaloMonitoring/CMakeLists.txt
+++ b/Calorimeter/CaloMonitoring/CMakeLists.txt
@@ -51,17 +51,12 @@ atlas_add_component( CaloMonitoring
    RecBackgroundEvent )
 
 # Install files from the package:
-atlas_install_joboptions( share/*.py )
-# Install files from the package:
-atlas_install_python_modules( python/*.py 
-  POST_BUILD_CMD ${ATLAS_FLAKE8} )
-
-atlas_add_test( flake8_share
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share
-                POST_EXEC_SCRIPT nopost.sh )
+atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
 
+# Tests:
 atlas_add_test( flake8_rootMacros
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/rootMacros
+                SCRIPT ${ATLAS_FLAKE8} ${CMAKE_CURRENT_SOURCE_DIR}/rootMacros
                 POST_EXEC_SCRIPT nopost.sh )
 
 atlas_add_test( TileCaloCellMonAlg_test
diff --git a/Calorimeter/CaloTrackingGeometry/CMakeLists.txt b/Calorimeter/CaloTrackingGeometry/CMakeLists.txt
index e6fef03aad3702afc1056b75cbd6a23d366c8706..6465c5c24b463435c3f1ea96081b7196276004b2 100644
--- a/Calorimeter/CaloTrackingGeometry/CMakeLists.txt
+++ b/Calorimeter/CaloTrackingGeometry/CMakeLists.txt
@@ -46,13 +46,5 @@ atlas_add_dictionary( CaloTrackingGeometryDict
                       LINK_LIBRARIES CaloTrackingGeometryLib )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
-atlas_install_joboptions( share/*.py )
-
-atlas_add_test( flake8
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python
-                POST_EXEC_SCRIPT nopost.sh )
-
-atlas_add_test( flake8_share
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share
-                POST_EXEC_SCRIPT nopost.sh )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
+atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 )
diff --git a/Control/xAODDataSource/CMakeLists.txt b/Control/xAODDataSource/CMakeLists.txt
index 083575e27c5d087faea0cd8f4c5b0b271c45fda5..c5963b181df4d7b05f8a411f315d47b87b963c40 100644
--- a/Control/xAODDataSource/CMakeLists.txt
+++ b/Control/xAODDataSource/CMakeLists.txt
@@ -61,4 +61,4 @@ atlas_add_test( dataFrame_pytest
    LOG_IGNORE_PATTERN "Can.t find BranchInfo|Function should only be called" )
 
 # Install files from the package.
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/LArCalorimeter/LArBadChannelTool/CMakeLists.txt b/LArCalorimeter/LArBadChannelTool/CMakeLists.txt
index f1e6ffa1287319f1224c154bc014e568a7eae369..b241c2c5c6f3b35924a825127e0b36f460f866a4 100644
--- a/LArCalorimeter/LArBadChannelTool/CMakeLists.txt
+++ b/LArCalorimeter/LArBadChannelTool/CMakeLists.txt
@@ -51,14 +51,6 @@ atlas_add_test( LArBadChannelConfigTest
 
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
-atlas_install_joboptions( share/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
+atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 )
 atlas_install_scripts( share/LArBuildBadChannelDB.sh share/LArBuildMissingFebDB.sh )
-
-atlas_add_test( flake8
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python
-                POST_EXEC_SCRIPT nopost.sh )
-
-atlas_add_test( flake8_share
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share
-                POST_EXEC_SCRIPT nopost.sh )
diff --git a/LArCalorimeter/LArBadChannelTool/share/LArBadChannel2Ascii.py b/LArCalorimeter/LArBadChannelTool/share/LArBadChannel2Ascii.py
index 6c83c1d7b41e206bc52b8439fda38294cc9ccbb2..f3eed1363c4205023024f53b63a715133687bad0 100644
--- a/LArCalorimeter/LArBadChannelTool/share/LArBadChannel2Ascii.py
+++ b/LArCalorimeter/LArBadChannelTool/share/LArBadChannel2Ascii.py
@@ -41,7 +41,7 @@ globalflags.DataSource="data"
 globalflags.InputFormat="bytestream"
 if 'OFLP' not in DBInstance:
    globalflags.DatabaseInstance=DBInstance
-	
+
 from AthenaCommon.JobProperties import jobproperties
 jobproperties.Global.DetDescrVersion = "ATLAS-R2-2015-04-00-00"
 
diff --git a/LArCalorimeter/LArBadChannelTool/share/LArBadChannelDBAlg.py b/LArCalorimeter/LArBadChannelTool/share/LArBadChannelDBAlg.py
index f05d83a5f750291a306aedd28011d2ee9faffc2e..ffc27289cba4e03e4d1ac570e62bb95496d6affb 100644
--- a/LArCalorimeter/LArBadChannelTool/share/LArBadChannelDBAlg.py
+++ b/LArCalorimeter/LArBadChannelTool/share/LArBadChannelDBAlg.py
@@ -100,7 +100,7 @@ OutputTagList=[Tag]
 
 from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
 theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg","dummy.pool.root",
-					   OutputList,OutputTagList,True)
+                                           OutputList,OutputTagList,True)
 
 theOutputConditionsAlg.Run1 = IOVBeginRun
 theOutputConditionsAlg.LB1 = IOVBeginLB
diff --git a/LArCalorimeter/LArBadChannelTool/share/LArMissingFebDbAlg.py b/LArCalorimeter/LArBadChannelTool/share/LArMissingFebDbAlg.py
index 985416680830466c8895bf81f3c04fcd2e3a6411..30d9bd2b91ab6abeb16e06700166e951cebd4868 100644
--- a/LArCalorimeter/LArBadChannelTool/share/LArMissingFebDbAlg.py
+++ b/LArCalorimeter/LArBadChannelTool/share/LArMissingFebDbAlg.py
@@ -34,7 +34,7 @@ import AthenaCommon.AtlasUnixGeneratorJob
 from AthenaCommon.GlobalFlags import  globalflags
 globalflags.DataSource="data"
 globalflags.InputFormat="bytestream"
-	
+
 from AthenaCommon.JobProperties import jobproperties
 jobproperties.Global.DetDescrVersion = "ATLAS-R2-2015-04-00-00"
 
@@ -97,7 +97,7 @@ OutputTagList=[FEBTag]
 WriteIOV=True
 from RegistrationServices.OutputConditionsAlg import OutputConditionsAlg
 theOutputConditionsAlg=OutputConditionsAlg("OutputConditionsAlg","dummy.pool.root",
-					   OutputList,OutputTagList,WriteIOV)
+                                           OutputList,OutputTagList,WriteIOV)
 
 theOutputConditionsAlg.Run1 = IOVBeginRun
 theOutputConditionsAlg.LB1 = IOVBeginLB
diff --git a/LArCalorimeter/LArBadChannelTool/share/LArMissingFebs2Ascii.py b/LArCalorimeter/LArBadChannelTool/share/LArMissingFebs2Ascii.py
index e6d2b3e335e98d345f4b756aefd8494cd37e563b..d8f767d1a060b70263d17c2ad40ad10f0a4bb183 100644
--- a/LArCalorimeter/LArBadChannelTool/share/LArMissingFebs2Ascii.py
+++ b/LArCalorimeter/LArBadChannelTool/share/LArMissingFebs2Ascii.py
@@ -30,7 +30,7 @@ import AthenaCommon.AtlasUnixGeneratorJob
 from AthenaCommon.GlobalFlags import  globalflags
 globalflags.DataSource="data"
 globalflags.InputFormat="bytestream"
-	
+
 from AthenaCommon.JobProperties import jobproperties
 jobproperties.Global.DetDescrVersion = "ATLAS-R2-2015-04-00-00"
 
diff --git a/LArCalorimeter/LArCabling/CMakeLists.txt b/LArCalorimeter/LArCabling/CMakeLists.txt
index f0f6104d6035fcc03c85cb462880d136e96a0a75..2b24348c698a7aa49d4983be1efae9d5fcfaaa83 100644
--- a/LArCalorimeter/LArCabling/CMakeLists.txt
+++ b/LArCalorimeter/LArCabling/CMakeLists.txt
@@ -43,18 +43,10 @@ atlas_add_dictionary( LArCablingDict
                       LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} CaloIdentifier AthenaBaseComps AthenaKernel StoreGateLib SGtests AthenaPoolUtilities Identifier GaudiKernel LArIdentifier PathResolver LArCablingLib )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
-atlas_install_joboptions( share/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
+atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 )
 atlas_install_runtime( share/FEBtoRODfred_v10.data )
 
 if( NOT SIMULATIONBASE AND NOT GENERATIONBASE )
   atlas_add_test( LArCablingConfig    SCRIPT python -m LArCabling.LArCablingConfig POST_EXEC_SCRIPT nopost.sh )
 endif()
-
-atlas_add_test( flake8
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python
-                POST_EXEC_SCRIPT nopost.sh )
-
-atlas_add_test( flake8_share
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share
-                POST_EXEC_SCRIPT nopost.sh )
diff --git a/LArCalorimeter/LArCafJobs/CMakeLists.txt b/LArCalorimeter/LArCafJobs/CMakeLists.txt
index 76918f736c954c2af79115e9f2384c63cc72708a..dc9e4624743c4850e043c3f0d07aa719e70d5562 100644
--- a/LArCalorimeter/LArCafJobs/CMakeLists.txt
+++ b/LArCalorimeter/LArCafJobs/CMakeLists.txt
@@ -96,14 +96,6 @@ atlas_add_executable( LArSamplesMerge
                       LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} CaloIdentifier AthenaBaseComps StoreGateLib SGtests GaudiKernel LArIdentifier LArRawConditions LArRawEvent LArToolsLib TrigDecisionToolLib TrigSteeringEvent CaloDetDescrLib DataQualityUtils Identifier xAODEventInfo LArRecConditions TrigConfHLTData TrigT1Result LArCafJobsLib )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
-atlas_install_joboptions( share/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
+atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 )
 atlas_install_scripts( share/LArHistMerge_trf.py share/LArCAF_tf.py share/LArNoiseBursts_tf.py share/LArNoiseBursts_fromraw_tf.py )
-
-atlas_add_test( flake8
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python
-                POST_EXEC_SCRIPT nopost.sh )
-
-atlas_add_test( flake8_share
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900,ATL901 ${CMAKE_CURRENT_SOURCE_DIR}/share
-                POST_EXEC_SCRIPT nopost.sh )
diff --git a/LArCalorimeter/LArG4/LArG4GenShowerLib/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4GenShowerLib/CMakeLists.txt
index 9e731829fbf9dec146e3f16a60869a7c26f36310..ac94939aa710b17a4d452ca8094afc81424d117b 100644
--- a/LArCalorimeter/LArG4/LArG4GenShowerLib/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4GenShowerLib/CMakeLists.txt
@@ -47,13 +47,5 @@ atlas_add_dictionary( LArG4GenShowerLibDict
                       LINK_LIBRARIES ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthContainers GaudiKernel G4AtlasToolsLib GeneratorObjects LArG4Code LArG4ShowerLib LArG4GenShowerLibLib )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
-atlas_install_scripts( share/*.py )
-
-atlas_add_test( flake8
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python
-                POST_EXEC_SCRIPT nopost.sh )
-
-atlas_add_test( flake8_share
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900,ATL901 ${CMAKE_CURRENT_SOURCE_DIR}/share
-                POST_EXEC_SCRIPT nopost.sh )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
+atlas_install_scripts( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 )
diff --git a/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt
index b0a45222a994d3b0dd1baf8f6f69da67f2e44954..bce9b6c29ee1a3e0762608468caeee75008ea332 100644
--- a/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4H6SD/CMakeLists.txt
@@ -49,8 +49,4 @@ atlas_add_component( LArG4H6SD
                      LINK_LIBRARIES ${CORAL_LIBRARIES} ${Boost_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} GaudiKernel CaloG4SimLib CaloSimEvent AthenaBaseComps AthenaKernel StoreGateLib SGtests GeoModelUtilities Identifier GeneratorObjects LArG4Code LArG4RunControl LArG4TBSimEvent LArReadoutGeometry LArSimEvent G4AtlasInterfaces G4AtlasToolsLib SimHelpers HitManagement MCTruth TBEvent PathResolver GeoModelInterfaces RDBAccessSvcLib )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
-
-atlas_add_test( flake8
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python
-                POST_EXEC_SCRIPT nopost.sh )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
diff --git a/LArCalorimeter/LArG4/LArG4Validation/CMakeLists.txt b/LArCalorimeter/LArG4/LArG4Validation/CMakeLists.txt
index fe54bd51a05976856fd7bc42e52ff01022c3a631..dd64ac528e3709625d88109c67db47442f92be8b 100644
--- a/LArCalorimeter/LArG4/LArG4Validation/CMakeLists.txt
+++ b/LArCalorimeter/LArG4/LArG4Validation/CMakeLists.txt
@@ -32,15 +32,7 @@ atlas_add_component( LArG4Validation
                      LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel CaloDetDescrLib CaloIdentifier AthenaBaseComps StoreGateLib SGtests GeoAdaptors GeneratorObjects LArSimEvent MagFieldInterfaces egammaEvent )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
-atlas_install_joboptions( share/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
+atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 )
 atlas_install_runtime( test/*.xml )
 atlas_install_scripts( share/AODElectronContainerReader.py share/LArG4ValidationGenerate.py share/LArG4AODNtuplePlotter.py share/LArG4ValidationPlotter.py )
-
-atlas_add_test( flake8
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python
-                POST_EXEC_SCRIPT nopost.sh )
-
-atlas_add_test( flake8_share
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share
-                POST_EXEC_SCRIPT nopost.sh )
diff --git a/LArCalorimeter/LArG4/LArG4Validation/share/LArG4AODNtuplePlotter.py b/LArCalorimeter/LArG4/LArG4Validation/share/LArG4AODNtuplePlotter.py
index 78ffd9a9fa92691a5bee427dc16448a727dca55a..0c558ca4793ec4c68c73ed8c5c554ee67dbf2bcd 100755
--- a/LArCalorimeter/LArG4/LArG4Validation/share/LArG4AODNtuplePlotter.py
+++ b/LArCalorimeter/LArG4/LArG4Validation/share/LArG4AODNtuplePlotter.py
@@ -80,8 +80,8 @@ split_canv = options.split_canvas.split(":")
 split_canv = map(int,split_canv)
 
 from LArG4Validation.LArG4PlottingScript import parseRoots, defaultRoots, \
-     parsePlots, fillPlots, dividePlots, savePlots, drawPlots, PlotEntry, \
-     createPlots
+	parsePlots, fillPlots, dividePlots, savePlots, drawPlots, PlotEntry, \
+	createPlots
 
 if (len(split_canv) != 2) :
 	printfunc ("ERROR: wrong split parameter")
diff --git a/LArCalorimeter/LArG4/LArG4Validation/share/LArG4ValidationGenerate.py b/LArCalorimeter/LArG4/LArG4Validation/share/LArG4ValidationGenerate.py
index 5e33d7fa7459536899288fb5dc7865871a399260..df242d29f64bce61e51b23e5afc9045e937f1b68 100755
--- a/LArCalorimeter/LArG4/LArG4Validation/share/LArG4ValidationGenerate.py
+++ b/LArCalorimeter/LArG4/LArG4Validation/share/LArG4ValidationGenerate.py
@@ -100,7 +100,7 @@ if (options.parameterize > 0):
              ServiceMgr += LArG4ShowerLibSvc()
         ServiceMgr.LArG4ShowerLibSvc.FileNameList = options.fsLibs
     
-	
+
 ## Set Event #
 simFlags.RunNumber = options.runNumber
 
diff --git a/LArCalorimeter/LArG4/LArG4Validation/share/LArG4ValidationPlotter.py b/LArCalorimeter/LArG4/LArG4Validation/share/LArG4ValidationPlotter.py
index 934ce8273ec1a095ff245886cb5c3027e41a40cc..b40f643db637cf2473a7efe07ccd78db64c00457 100755
--- a/LArCalorimeter/LArG4/LArG4Validation/share/LArG4ValidationPlotter.py
+++ b/LArCalorimeter/LArG4/LArG4Validation/share/LArG4ValidationPlotter.py
@@ -74,8 +74,8 @@ split_canv = options.split_canvas.split(":")
 split_canv = map(int,split_canv)
 
 from LArG4Validation.LArG4PlottingScript import parseRoots, defaultRoots, \
-     parsePlots, fillPlots, dividePlots, savePlots, drawPlots, PlotEntry, \
-     createPlots
+	parsePlots, fillPlots, dividePlots, savePlots, drawPlots, PlotEntry, \
+	createPlots
 
 if (len(split_canv) != 2) :
 	printfunc ("ERROR: wrong split parameter")
diff --git a/LArCalorimeter/LArG4/LArG4Validation/share/postInclude.SingleTrackValidation.py b/LArCalorimeter/LArG4/LArG4Validation/share/postInclude.SingleTrackValidation.py
index 339496ac9471017082bf310d390a7a8a0b5b190b..f57902df7202b5a30ce521baa8eaf68611f52009 100644
--- a/LArCalorimeter/LArG4/LArG4Validation/share/postInclude.SingleTrackValidation.py
+++ b/LArCalorimeter/LArG4/LArG4Validation/share/postInclude.SingleTrackValidation.py
@@ -9,7 +9,7 @@ topSequence += SingleTrackValidation()
 # The following lines are to construct our ntuple:
 
 if "RootFileName" not in dir() :
-	RootFileName = "sp.tuple.root"
+        RootFileName = "sp.tuple.root"
  
 NtupleSvc = Service( "NTupleSvc" )
 NtupleSvc.Output = [ "FILE DATAFILE=\'" + RootFileName + "\' OPT='NEW'" ]
diff --git a/LArCalorimeter/LArG4TB/H6G4Sim/CMakeLists.txt b/LArCalorimeter/LArG4TB/H6G4Sim/CMakeLists.txt
index 25903fc116ba1ac59b728b9dba86a13f48627c87..3c9b06cbaee12276c2521f690c40220f90633391 100644
--- a/LArCalorimeter/LArG4TB/H6G4Sim/CMakeLists.txt
+++ b/LArCalorimeter/LArG4TB/H6G4Sim/CMakeLists.txt
@@ -6,15 +6,7 @@
 atlas_subdir( H6G4Sim )
 
 # Install files from the package:
-atlas_install_python_modules( python/h6prod_getxy.py python/__init__.py )
-atlas_install_joboptions( share/*.py )
+atlas_install_python_modules( python/h6prod_getxy.py python/__init__.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
+atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F403,F405,F821 )
 atlas_install_runtime( G4macros/*.mac )
 atlas_install_scripts( share/cbtG4_trf.py )
-
-atlas_add_test( flake8
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python
-                POST_EXEC_SCRIPT nopost.sh )
-
-atlas_add_test( flake8_share
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F403,F405,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share
-                POST_EXEC_SCRIPT nopost.sh )
diff --git a/LArCalorimeter/LArRecUtils/CMakeLists.txt b/LArCalorimeter/LArRecUtils/CMakeLists.txt
index 76668618861c492ac45f57c7c9688b098bb5923d..e670a84e222883a62e52af6573028746eef79528 100644
--- a/LArCalorimeter/LArRecUtils/CMakeLists.txt
+++ b/LArCalorimeter/LArRecUtils/CMakeLists.txt
@@ -64,8 +64,8 @@ atlas_add_test( dummy_test
                 LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} CaloDetDescrLib CaloEvent CaloIdentifier CaloUtilsLib AthenaBaseComps AthenaKernel AthAllocators StoreGateLib SGtests AthenaPoolUtilities Identifier GaudiKernel LArCablingLib LArIdentifier LArRawConditions LArRawEvent LArRecEvent TestTools CaloGeoHelpers SGTools xAODEventInfo LArCOOLConditions LArRawUtilsLib CaloConditions PathResolver LArRecUtilsLib )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
-atlas_install_joboptions( share/*.py )
+atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
+atlas_install_joboptions( share/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-ignore=F401,F821 )
 
 atlas_add_test( LArFCalTowerBuilderTool
                 SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/LArFCalTowerBuilderTool_test.sh
@@ -79,13 +79,3 @@ atlas_add_test( LArRecUtilsConfig_test
 atlas_add_test( LArADC2MeVCondAlgConfig_test
                 SCRIPT python -m LArRecUtils.LArADC2MeVCondAlgConfig
                 LOG_SELECT_PATTERN "ComponentAccumulator|^---" )
-
-
-
-atlas_add_test( flake8
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 ${CMAKE_CURRENT_SOURCE_DIR}/python
-                POST_EXEC_SCRIPT nopost.sh )
-
-atlas_add_test( flake8_share
-                SCRIPT flake8 --select=ATL,F,E7,E9,W6 --ignore=F401,F821,ATL900 ${CMAKE_CURRENT_SOURCE_DIR}/share
-                POST_EXEC_SCRIPT nopost.sh )
diff --git a/LArCalorimeter/LArRecUtils/python/LArMCSymCondAlg.py b/LArCalorimeter/LArRecUtils/python/LArMCSymCondAlg.py
index ba06f935618da4f910a9cffa3c94a2a0d82b7c2f..32d543f193e9bd1b092305f529fd916a05680b5a 100644
--- a/LArCalorimeter/LArRecUtils/python/LArMCSymCondAlg.py
+++ b/LArCalorimeter/LArRecUtils/python/LArMCSymCondAlg.py
@@ -1,3 +1,5 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 def LArMCSymCondAlgDefault():
     from AthenaCommon.AlgSequence import AthSequencer
     condSeq = AthSequencer("AthCondSeq")
diff --git a/Projects/AthSimulation/CMakeLists.txt b/Projects/AthSimulation/CMakeLists.txt
index 138d3117683f579dd53250bd2681662e04026fd9..db19c97adbba36741ed8bb5fd2c629f2e36e065c 100644
--- a/Projects/AthSimulation/CMakeLists.txt
+++ b/Projects/AthSimulation/CMakeLists.txt
@@ -7,6 +7,14 @@ string( STRIP ${_version} _version )
 project( AthSimulation VERSION ${_version} LANGUAGES C CXX Fortran )
 unset( _version )
 
+# Configure flake8:
+set( ATLAS_FLAKE8 flake8_atlas --select ATL,F,E101,E7,E9,W6
+                               --ignore ATL238,ATL9,E701,E702,E704,E741
+                               --enable-extensions ATL902
+   CACHE STRING "Default flake8 command" )
+set( ATLAS_PYTHON_CHECKER ${ATLAS_FLAKE8} --filterFiles AthenaConfiguration
+   CACHE STRING "Python checker command to run during Python module compilation" )
+
 # Find the ATLAS CMake code:
 find_package( AtlasCMake QUIET )
 
diff --git a/Projects/AthSimulation/cmake/PreConfig.cmake.in b/Projects/AthSimulation/cmake/PreConfig.cmake.in
index aa1fba778e5ae46d70f9a48d97b7c9ff73d2b8a7..3057a37ad6b6e2a1c1dd99f001320cf4048c3408 100644
--- a/Projects/AthSimulation/cmake/PreConfig.cmake.in
+++ b/Projects/AthSimulation/cmake/PreConfig.cmake.in
@@ -2,6 +2,12 @@
 # Pre-config script to propagate variables to downstream projects
 #
 
+# Set up the project's flake8 usage.
+set( ATLAS_FLAKE8 @ATLAS_FLAKE8@
+   CACHE STRING "Default flake8 command" )
+set( ATLAS_PYTHON_CHECKER @ATLAS_PYTHON_CHECKER@
+   CACHE STRING "Python checker command to run during Python module compilation" )
+
 # Due to the way CMake handles propagation of targets to dependees,
 # any "external" that is used through imported targets in the build need
 # to be imported explicitly here.
diff --git a/Projects/Athena/CMakeLists.txt b/Projects/Athena/CMakeLists.txt
index 150d15736ccc99fcf5006078a8db512e0863adfe..886aa8abf6ecfafcebea496e008a6e82851265d6 100644
--- a/Projects/Athena/CMakeLists.txt
+++ b/Projects/Athena/CMakeLists.txt
@@ -126,8 +126,5 @@ install( FILES
    ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake
    DESTINATION ${CMAKE_INSTALL_CMAKEDIR} )
 
-# Temporary alias to limit number of processes (ATLINFR-3046)
-atlas_add_alias( flake8 \${AthenaExternals_DIR}/${CMAKE_INSTALL_BINDIR}/flake8 -j1 )
-
 # Package up the release using CPack:
 atlas_cpack_setup()