Example #1
0
File: manage.py Project: 0x1997/fmt
def create_build_env():
    """Create a build environment."""
    class Env:
        pass
    env = Env()

    # Import the documentation build module.
    env.fmt_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    sys.path.insert(0, os.path.join(env.fmt_dir, 'doc'))
    import build

    env.build_dir = 'build'

    # Virtualenv and repos are cached to speed up builds.
    build.create_build_env(os.path.join(env.build_dir, 'virtualenv'))

    env.fmt_repo = Git(os.path.join(env.build_dir, 'fmt'))
    return env
Example #2
0
def create_build_env():
    """Create a build environment."""
    class Env:
        pass
    env = Env()

    # Import the documentation build module.
    env.fmt_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    sys.path.insert(0, os.path.join(env.fmt_dir, 'doc'))
    import build

    env.build_dir = 'build'
    env.versions = build.versions

    # Virtualenv and repos are cached to speed up builds.
    build.create_build_env(os.path.join(env.build_dir, 'virtualenv'))

    env.fmt_repo = Git(os.path.join(env.build_dir, 'fmt'))
    return env
Example #3
0
    check_call(['sudo', 'npm', 'install', '-g', '[email protected]', 'less-plugin-clean-css'])
    deb_file = 'doxygen_1.8.6-2_amd64.deb'
    urllib.urlretrieve('http://mirrors.kernel.org/ubuntu/pool/main/d/doxygen/' +
                       deb_file, deb_file)
    check_call(['sudo', 'dpkg', '-i', deb_file])

fmt_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))

build = os.environ['BUILD']
if build == 'Doc':
    travis = 'TRAVIS' in os.environ
    if travis:
        install_dependencies()
    sys.path.insert(0, os.path.join(fmt_dir, 'doc'))
    import build
    build.create_build_env()
    html_dir = build.build_docs()
    repo = 'fmtlib.github.io'
    if travis and 'KEY' not in os.environ:
        # Don't update the repo if building on Travis from an account that
        # doesn't have push access.
        print('Skipping update of ' + repo)
        exit(0)
    # Clone the fmtlib.github.io repo.
    rmtree_if_exists(repo)
    git_url = 'https://github.com/' if travis else '[email protected]:'
    check_call(['git', 'clone', git_url + 'fmtlib/{}.git'.format(repo)])
    # Copy docs to the repo.
    target_dir = os.path.join(repo, 'dev')
    rmtree_if_exists(target_dir)
    shutil.copytree(html_dir, target_dir, ignore=shutil.ignore_patterns('.*'))
    urllib.urlretrieve(
        'http://mirrors.kernel.org/ubuntu/pool/main/d/doxygen/' + deb_file,
        deb_file)
    check_call(['sudo', 'dpkg', '-i', deb_file])


fmt_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))

build = os.environ['BUILD']
if build == 'Doc':
    travis = 'TRAVIS' in os.environ
    if travis:
        install_dependencies()
    sys.path.insert(0, os.path.join(fmt_dir, 'doc'))
    import build
    build.create_build_env()
    html_dir = build.build_docs()
    repo = 'fmtlib.github.io'
    if travis and 'KEY' not in os.environ:
        # Don't update the repo if building on Travis from an account that
        # doesn't have push access.
        print('Skipping update of ' + repo)
        exit(0)
    # Clone the fmtlib.github.io repo.
    rmtree_if_exists(repo)
    git_url = 'https://github.com/' if travis else '[email protected]:'
    check_call(['git', 'clone', git_url + 'fmtlib/{}.git'.format(repo)])
    # Copy docs to the repo.
    target_dir = os.path.join(repo, 'dev')
    rmtree_if_exists(target_dir)
    shutil.copytree(html_dir, target_dir, ignore=shutil.ignore_patterns('.*'))
Example #5
0
  def pull(self, *args):
    return self.call('pull', args, cwd=self.dir)

  def update(self, *args):
    if not os.path.exists(self.dir):
      self.clone(*args)

# Import the documentation build module.
fmt_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, os.path.join(fmt_dir, 'doc'))
import build

build_dir = 'build'

# Virtualenv and repos are cached to speed up builds.
build.create_build_env(os.path.join(build_dir, 'virtualenv'))

fmt_repo = Git(os.path.join(build_dir, 'fmt'))
fmt_repo.update('[email protected]:fmtlib/fmt')

doc_repo = Git(os.path.join(build_dir, 'fmtlib.github.io'))
doc_repo.update('[email protected]:fmtlib/fmtlib.github.io')

for version in ['1.0.0', '1.1.0', '2.0.0', '3.0.0']:
  fmt_repo.clean('-f', '-d')
  fmt_repo.reset('--hard')
  fmt_repo.checkout(version)
  target_doc_dir = os.path.join(fmt_repo.dir, 'doc')
  # Remove the old theme.
  for entry in os.listdir(target_doc_dir):
    path = os.path.join(target_doc_dir, entry)
Example #6
0
        return self.call('pull', args, cwd=self.dir)

    def update(self, *args):
        if not os.path.exists(self.dir):
            self.clone(*args)


# Import the documentation build module.
fmt_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, os.path.join(fmt_dir, 'doc'))
import build

build_dir = 'build'

# Virtualenv and repos are cached to speed up builds.
build.create_build_env(os.path.join(build_dir, 'virtualenv'))

fmt_repo = Git(os.path.join(build_dir, 'fmt'))
fmt_repo.update('[email protected]:fmtlib/fmt')

doc_repo = Git(os.path.join(build_dir, 'fmtlib.github.io'))
doc_repo.update('[email protected]:fmtlib/fmtlib.github.io')

for version in ['1.0.0', '1.1.0', '2.0.0', '3.0.0']:
    fmt_repo.clean('-f', '-d')
    fmt_repo.reset('--hard')
    fmt_repo.checkout(version)
    target_doc_dir = os.path.join(fmt_repo.dir, 'doc')
    # Remove the old theme.
    for entry in os.listdir(target_doc_dir):
        path = os.path.join(target_doc_dir, entry)