Пример #1
0
 def _build_in_dir(self, package_request, build_dir, package_dir):
     params = package_request.params()
     
     package_request.write_source_to(build_dir)
     
     build_script = "whack/build"
     build_script_path = os.path.join(build_dir, build_script)
     if not os.path.exists(build_script_path):
         message = "{0} script not found in package source {1}".format(
             build_script, package_request.source_uri
         )
         raise FileNotFoundError(message)
     
     build_env = params_to_env(params)
     self._fetch_downloads(build_dir, build_env)
     mkdir_p(package_dir)
     build_command = [
         "whack-run",
         os.path.abspath(package_dir), # package_dir is mounted at WHACK_ROOT
         build_script_path, # build_script is executed
         WHACK_ROOT # WHACK_ROOT is passed as the first argument to build_script
     ]
     local.run(build_command, cwd=build_dir, update_env=build_env)
     write_file(
         os.path.join(package_dir, ".whack-package.json"),
         dodge.dumps(package_request.describe())
     )
Пример #2
0
def can_convert_data_classes_to_and_from_string():
    User = dodge.data_class("User", ["username", "password"])

    user = User("bob", "password1")
    serialised_user = dodge.dumps(user)
    unserialised_user = dodge.loads(serialised_user, User)

    expected_user = User("bob", "password1")
    assert_equal(unserialised_user, expected_user)
Пример #3
0
def can_convert_nested_data_classes_to_and_from_string():
    Profile = dodge.data_class("Profile", ["bio"])

    User = dodge.data_class("User", ["username", dodge.field("profile", type=Profile)])

    user = User("bob", Profile("I'm Bob."))
    serialised_user = dodge.dumps(user)
    unserialised_user = dodge.loads(serialised_user, User)
    assert_equal(user, unserialised_user)
Пример #4
0
def can_convert_data_classes_to_and_from_string():
    User = dodge.data_class("User", ["username", "password"])

    user = User("bob", "password1")
    serialised_user = dodge.dumps(user)
    unserialised_user = dodge.loads(serialised_user, User)

    expected_user = User("bob", "password1")
    assert_equal(unserialised_user, expected_user)
Пример #5
0
def can_convert_nested_data_classes_to_and_from_string():
    Profile = dodge.data_class("Profile", ["bio"])

    User = dodge.data_class("User", [
        "username",
        dodge.field("profile", type=Profile),
    ])

    user = User("bob", Profile("I'm Bob."))
    serialised_user = dodge.dumps(user)
    unserialised_user = dodge.loads(serialised_user, User)
    assert_equal(user, unserialised_user)