← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:handle-missing-sourcecode into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:handle-missing-sourcecode into launchpad:master.

Commit message:
Create sourcecode/ if necessary

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/396175

Now that sourcecode/Makefile has been removed (see https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/395856), the sourcecode/ directory may not exist on a fresh checkout, so create it if necessary.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:handle-missing-sourcecode into launchpad:master.
diff --git a/lib/devscripts/sourcecode.py b/lib/devscripts/sourcecode.py
index 5dc0e6d..d1d269f 100644
--- a/lib/devscripts/sourcecode.py
+++ b/lib/devscripts/sourcecode.py
@@ -352,6 +352,8 @@ def update_sourcecode(sourcecode_directory, config_filename, cache_filename,
         parse_config_file(config_file), public_only, use_http)
     config_file.close()
     cache = load_cache(cache_filename)
+    if not os.path.exists(sourcecode_directory):
+        os.makedirs(sourcecode_directory)
     branches = find_branches(sourcecode_directory)
     new, updated, removed = plan_update(branches, config)
     possible_transports = []
diff --git a/utilities/link-external-sourcecode b/utilities/link-external-sourcecode
index 0a2bb90..cf74283 100755
--- a/utilities/link-external-sourcecode
+++ b/utilities/link-external-sourcecode
@@ -7,6 +7,7 @@ import optparse
 from os import (
     curdir,
     listdir,
+    makedirs,
     symlink,
     unlink,
     )
@@ -112,6 +113,9 @@ if __name__ == '__main__':
     if options.parent is None:
         parser.error("Parent tree not specified.")
 
+    if not exists(join(options.target, 'sourcecode')):
+        makedirs(join(options.target, 'sourcecode'))
+
     missing_files = gen_missing_files(
         abspath(join(options.parent, 'sourcecode')),
         abspath(join(options.target, 'sourcecode')))