• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/support/scripts/pycompile.py
Yegor YefremovYegor Yefremov committed 549bbba67f517 May 2016
Raw file
Source viewDiff to previous
 
1
#!/usr/bin/env python
2
​
3
# Wrapper for python2 and python3 around compileall to raise exception
4
# when a python byte code generation failed.
5
#
6
# Inspired from:
7
#   http://stackoverflow.com/questions/615632/how-to-detect-errors-from-compileall-compile-dir
8
​
9
from __future__ import print_function
10
import sys
11
import py_compile
12
import compileall
13
​
14
class ReportProblem:
15
    def __nonzero__(self):
16
        type, value, traceback = sys.exc_info()
17
        if type is not None and issubclass(type, py_compile.PyCompileError):
18
            print("Cannot compile %s" %value.file)
19
            raise value
20
        return 1
21
​
22
report_problem = ReportProblem()
23
​
24
compileall.compile_dir(sys.argv[1], quiet=report_problem)
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.