Skip to content

Commit

Permalink
Updated build system
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonski committed May 21, 2019
1 parent d81d013 commit 921caa0
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 29 deletions.
12 changes: 5 additions & 7 deletions .gitignore
Expand Up @@ -2,12 +2,10 @@
.mr.developer.cfg
.projectile
bin
parts
var
build
develop-eggs
src/senaite.api
src/senaite.core
dist
build
src/senaite.core.supermodel
src/senaite.lims
eggs
parts
src/senaite.*
var
27 changes: 18 additions & 9 deletions buildout.cfg
Expand Up @@ -7,10 +7,10 @@ parts =
write_code_headers

extends =
http://dist.plone.org/release/4.3.17/versions.cfg
http://dist.plone.org/release/4.3.18/versions.cfg

find-links =
http://dist.plone.org/release/4.3.17
http://dist.plone.org/release/4.3.18
http://dist.plone.org/thirdparty

eggs =
Expand All @@ -28,30 +28,33 @@ zcml =
versions = versions
extensions = mr.developer

eggs-directory = ~/.buildout/eggs
download-cache = ~/.buildout/downloads
eggs-directory = ${buildout:directory}/eggs
download-cache = ${buildout:directory}/downloads

sources = sources
auto-checkout = *

develop = .

[sources]
senaite.lims = git git://github.com/senaite/senaite.lims.git pushurl=git@github.com:senaite/senaite.lims.git branch=master
senaite.core = git git://github.com/senaite/senaite.core.git pushurl=git@github.com:senaite/senaite.core.git branch=master
senaite.api = git git://github.com/senaite/senaite.api.git pushurl=git@github.com:senaite/senaite.api.git branch=master
senaite.core.supermodel = git git://github.com/senaite/senaite.core.supermodel.git pushurl=git@github.com:senaite/senaite.api.git branch=master
senaite.core = git git://github.com/senaite/senaite.core.git pushurl=git@github.com:senaite/senaite.core.git branch=master
senaite.core.supermodel = git git://github.com/senaite/senaite.core.supermodel.git pushurl=git@github.com:senaite/senaite.core.supermodel.git branch=master
senaite.core.listing = git git://github.com/senaite/senaite.core.listing.git pushurl=git@github.com:senaite/senaite.core.listing.git branch=master
senaite.impress = git git://github.com/senaite/senaite.impress.git pushurl=git@github.com:senaite/senaite.impress.git branch=master
senaite.jsonapi = git git://github.com/senaite/senaite.jsonapi.git pushurl=git@github.com:senaite/senaite.jsonapi.git branch=master
senaite.lims = git git://github.com/senaite/senaite.lims.git pushurl=git@github.com:senaite/senaite.lims.git branch=master

[lxml]
recipe = z3c.recipe.staticlxml
egg = lxml==3.6.0
egg = lxml==4.2.1
force = false
static-build = true

[instance]
recipe = plone.recipe.zope2instance
user = admin:admin
http-address = 0.0.0.0:8080
http-address = 127.0.0.1:8080
eggs =
senaite.databox
${buildout:eggs}
Expand All @@ -77,6 +80,12 @@ output = ${buildout:directory}/bin/write_code_headers
input = ${buildout:directory}/templates/write_code_headers.py.in
mode = 755

[update_sources]
recipe = collective.recipe.template
output = ${buildout:directory}/bin/update_sources
input = ${buildout:directory}/templates/update_sources.in
mode = 755

[versions]
setuptools =
zc.buildout =
13 changes: 13 additions & 0 deletions templates/update_sources.in
@@ -0,0 +1,13 @@
#!/bin/bash

BASE=${buildout:directory}
SRC=$BASE/src
cd $SRC

for d in `find $SRC -mindepth 1 -maxdepth 1 -type d`
do
cd $d
echo -e "Current branch of repository $(basename $d): $(git rev-parse --abbrev-ref HEAD)"
git pull
cd ..
done
46 changes: 33 additions & 13 deletions templates/write_code_headers.py.in
Expand Up @@ -8,14 +8,28 @@ import sys
import optparse
from datetime import datetime

SRC_DIR = "${buildout:directory}/src/senaite/databox"
SRC_DIR = "${buildout:directory}/src/senaite"

YEAR_FROM = "2018"
TEMPLATE = """# -*- coding: utf-8 -*-
#
# This file is part of SENAITE.DATABOX
# This file is part of SENAITE.DATABOX.
#
# SENAITE.DATABOX is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright {copy_years} by it's authors.
# Some rights reserved, see README and LICENSE.
"""

Expand All @@ -34,15 +48,17 @@ if __name__ == "__main__":

parser = optparse.OptionParser()

parser.add_option('-d', '--directory',
dest='directory',
parser.add_option("-d", "--directory",
dest="directory",
default=SRC_DIR,
help='Source code directory to scan [default: %default]')
help="Source code directory to scan "
"[default: %default]")

parser.add_option('-e', '--extensions',
dest='extensions',
default='.py',
help='Comma separated list of file extensions [default: %default]')
parser.add_option("-e", "--extensions",
dest="extensions",
default=".py",
help="Comma separated list of file extensions "
"[default: %default]")

options, args = parser.parse_args(sys.argv)

Expand All @@ -51,10 +67,13 @@ if __name__ == "__main__":
extensions = map(lambda ext: ext.strip(), options.extensions.split(","))

def callback(arg, dirname, names):
# only write the header to the files where the file extension match (.py per default)
file_names = filter(lambda x: os.path.splitext(x)[-1] in extensions, names)
# only write the header to the files where the file extension match
# (.py per default)
file_names = filter(lambda x: os.path.splitext(x)[-1] in extensions,
names)
# generate a list of full file paths
file_paths = map(lambda x: os.path.abspath(os.path.join(dirname, x)), file_names)
file_paths = map(lambda x: os.path.abspath(os.path.join(dirname, x)),
file_names)
# make a mapping of path -> file data
for path in file_paths:
lines = open(path, "r").readlines()
Expand All @@ -78,7 +97,8 @@ if __name__ == "__main__":

# if we reach this point, we found the first code line
if skip:
print "Found first code line for file {} at {}".format(path, num)
print "Found first code line for file {} at {}".format(
path, num)
skip = False

# append all code lines below the new_lines
Expand Down

0 comments on commit 921caa0

Please sign in to comment.