
If we run the tools (create-directories or check-all-candidacies) under python3 they'll fail with silly errors (like[1]). This is because we have a number of assumptions they we'll be running under python2 like: - pickle.protocol: we done specify one so if we write a pickle file from python3 we can't read it in python2. - urllib and urlparse: those modules change paths in python 2 or 3 so use the six helpers to get the bits we want. - Explicitly write files in binary format - Various str vs bytes issues - dict().keys() returns dict_keys under python3 explictly cast that to list() After addressing these issues we can run the tools under either python2 or python3. To make this easy to check create explicit ven2 and venv3 test environments, leaving all other testenvs to use the system default. [1] http://paste.openstack.org/show/593823/ Change-Id: I20334a52500847c810b486c9c8b108e75a5d6303
40 lines
1.3 KiB
Python
Executable File
40 lines
1.3 KiB
Python
Executable File
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from __future__ import absolute_import
|
|
from __future__ import print_function
|
|
from __future__ import unicode_literals
|
|
|
|
import os
|
|
|
|
from openstack_election import utils
|
|
|
|
|
|
def main():
|
|
if not os.path.isdir("candidates"):
|
|
print("candidates directory not found")
|
|
exit(1)
|
|
|
|
base_dir = "candidates/%s" % utils.conf['release']
|
|
if os.path.exists(base_dir):
|
|
print("%s: directory already exists" % base_dir)
|
|
exit(1)
|
|
|
|
projects = utils.get_projects()
|
|
project_list = list(projects.keys())
|
|
project_list.sort()
|
|
for project in project_list + ["TC"]:
|
|
dpath = "%s/%s" % (base_dir, utils.name2dir(project))
|
|
os.makedirs(dpath)
|
|
open("%s/.placeholder" % dpath, "w").close()
|
|
print("[+] Created %s" % (dpath))
|